我想使用索引访问列表中的值,但我不能,因为它在嵌套列表中,有人可以帮助我正确访问列表中的值而没有错误
def get_info():
infile = open('lol.txt','r')
f = infile.readlines()
id = input('enter your id:')
new_list = []
for line in f:
if line.split(':')[0] == id:
(line.strip())
new_list.append(line.split(':'))
print(new_list)
print(new_list[1]) # error
get_info()
输出:[['1111', 'zoki', '2', '3', '1\n']]