python .readlines()
作者:互联网
filename = os.path.join(container_dir,"info.txt") #
with open(filename) as myfile:
lines = len(myfile.readlines()) #
os.path.join()
路径拼接 container_dir/info.txt
myfile.readlines()
一次性读取整个文件,自动将文件内容分析成一个行的列表。有几行列表里面就有几个元素,lines就是有几行
标签:container,python,readlines,filename,myfile,path,txt 来源: https://blog.csdn.net/qq_37006426/article/details/116720311