Input is a txt file containing list of numbers:
62521
93897
....
107428
My approach:
with open('filelocation/file name.txt') as f:
read_data = f.read()
print(read_data)
After this I am able to see the data in txt so I am sure now that 'open' and 'read' is working.
Now needed result:
list = [62521, 93897,.....,107428 ]
How do I convert the into a list so that I am able to go with my calculations with the list?
Alternatively is it possible to work with each numbers (62521, 93897...) directly from the txt file?
I have to do some steps of calculations with them. Will it be easier to read each line (i.e., numbers) at one go, do the whole calculations and run it in a loop rather than converting the whole input in single list?
Are there any other better solutions?