2019-08-09 Python读取每一行并存到list数组中
2019-08-09 本文已影响0人
Shalom小白
代码
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)