# -*- coding: utf-8 -*-
__author__ = "Liangjian (http://blog.csdn.net/wsliangjian)"
__version__ = "1.0.0"
__copyright__ = "Copyright (c) 2013-2013 Liangjian 2013-11-06 18:04:00"
__license__ = "GNU"
import time
start_time = time.time()
def block(file, size=65536):
while True:
nb = file.read(size)
if not nb:
break
yield nb
with open("bigfile.txt", "r") as f:
print(sum(line.count("\n") for line in block(f)))
print(time.time() - start_time, "seconds")