count = len(open(filepath,'rU').readlines())
import linecache
count = linecache.getline(filename,linenum)
str = linecache.getlines(filename)
#!/usr/bin/python
# -*- coding: utf-8 -*-
''' count the number of lines when file is big '''
count=0
fp=open("filename.txt","r")
while 1:
buffer=fp.read(8*1024*1024)
if not buffer:
break
count+=buffer.count('\n')
print count
print count
print 'over'
fp.close()