计算某一个文件的行数
#_*_coding:utf_8_import sysimport os'''计算某一个文件的行数'''def countFileLines(filename): count = 0 try: handle = open(filename, 'r') for eachline in handle: count += 1 except IOError, e: print 'file open error', e print count return countcountFileLines('D:/study/practice/algorithm/sort.cpp')