Python 计算一个文件中有多少行即读取文件行数

如题所述

第1个回答  2017-10-19
with open(file) as f:
text=f.read()

length=len(text.splitlines())
相似回答