When I read in a text file of numbers:
1, 2, 3, 4, 5, 6, 7, 8
The list is created like:
dTags = ['1, 2, 3, 4, 5, 6, 7, 8']
I do not want the single quotes at the beginning and end of the list, so I just want it to be like:
dTags = [1, 2, 3, 4, 5, 6, 7, 8]
This is the code I am using:
dTags = []
with open("tagNumbersToTest.txt") as file:
for line in file:
line = line.strip() #or some other preprocessing
dTags.append(line) #storing everything in memory!
#print(dTags)
How can I achieve this?