python计算文本文件的行数
filename = "somefile.txt" myfile = open(filename) lines = len(myfile.readlines()) print "There are %d lines in %s" % (lines, filename)
python计算文本文件的行数
filename = "somefile.txt" myfile = open(filename) lines = len(myfile.readlines()) print "There are %d lines in %s" % (lines, filename)