代码
import sys
result=[]
with open('accounts.txt','r') as f:
for line in f:
result.append(list(line.strip('\n').split(','))[0])
print(result)
import sys
result=[]
with open('accounts.txt','r') as f:
for line in f:
result.append(list(line.strip('\n').split(','))[0])
print(result)
本文标题:2019-08-09 Python读取每一行并存到list数组中
本文链接:https://www.haomeiwen.com/subject/epkcjctx.html
网友评论