发布时间:2019-08-08 07:46:20编辑:auto阅读(1832)
fr = open(filename)
for line in fr.readlines():
if line.startswith("#"):
continue
else:
## do something with line
## could use fr.readlines()[1:] from second line
import linecache
content_list = linecache.getlines(filename)[1:] ## Here using getlines
fourth_line = linecache.getline(filename, 4) ## Here using getline
## the above method is simpler.
上一篇: python中的字典
下一篇: python操作文本
51592
51178
41683
38445
32931
29912
28620
23584
23516
21865
2019°
2732°
2282°
2209°
2682°
2237°
2984°
4919°
4776°
3393°