So I have a file ( user.txt ) containing this
James, 10, Orange
Andrew, 16, Yellow
Graham, 23, Pink
I want to make it so I can read the file into a nested list so I will have
print(user[0][1])
#10
I attempted:
with open("user.txt") as file:
user = [line.split(", ") for line in file.readlines()]
print(user[0][1])
however I get 'IndexError: list index out of range'
Hope someone can help