代码如下:
#coding=utf-8
content = []
with open('test.txt', 'r') as f:
for line in f.readlines():
content.append([line.strip('\n')])
print(content)
运行结果:
import sys
result=[]
with open('accounts.txt','r') as f:
for line in f:
result.append(list(line.strip('\n').split(',')))
print(result)