I’m new to python and I’m taking my first steps to create some scripts. I want to access a file and store the items into a list and access each item as its own variable. The format of the file is .txt and it’s as such but not limited to 3 columns it could be 4 or more.
textData,1
textData,2
textData,3,moreData
textData,4,moreData4
textData,5
I know how to read and append to a list and access individual items starting with [0] but when I do that I get textData, 1 for [0] and I only want textData on its own and 1 on its own and so on as I loop through the file.
Below is my start of this:
file = open('fileName','r')
list = []
for items in file:
list.append(items)
print(list[0])
Thank you for taking the time to read and provide direction.
listas a variable name, it shadows the built-inlist