python基础操作
作者:互联网
1. 按行读取文件
def readNode(filename):
resultList = []
with open(filename, 'r') as f:
while True:
line = f.readline() # string
if not line:
break
if line[0] == '#':
pass
else:
pageNode = line.split()
resultList.append(pageNode)
return resultList
标签:pageNode,python,基础,resultList,filename,按行,pass,操作,line 来源: https://www.cnblogs.com/MartinTai/p/14668117.html