Hi I am a Pyth noob and wanted to import a text file .To each line of the text file , assign a (fixed) name and sum a number (in increments of 1 from the first line to the last)using the while command for an assigned name.
Lets say I choose foo as an 'identifier' :
foo = 'line number'
while foo <=10:
print foo
foo+=1
I have 3 problems :
1) I do not know how to open/load the txt file.
2) I want to sum the word: linenumber and a numer in increments of 1 and make the content of the line a string so I can manipulate it ( with the name: linenumber+number in increment of one)
3) Do not know how many lines I will be loading and want it to make it automatically with a loop and break funtion.
Many thanks