filename = “F:\python工程\python02\wordcount.txt”
myfile = open(filename)
lines = len(myfile.readlines())
print(“There are %d lines in %s” % (lines, filename))
python如何统计出txt文件有多少行内容?
最新推荐文章于 2024-09-06 23:04:09 发布
filename = “F:\python工程\python02\wordcount.txt”
myfile = open(filename)
lines = len(myfile.readlines())
print(“There are %d lines in %s” % (lines, filename))