got a wierd issue so i guessed that the argument that is passed to the readline function is the line number so wrote a while loop to iterate through the lines but it doesn't print the lines. could someone explain why i am just getting first and last few characters? is the ' in I'm confusing it somehow?
BTW if you are having issues with theno such file exists with your text.txt then go to the tab add a character and delete it and then go back to your script and run it
my_file = open("text.txt", "r") i=1 while len(my_file.readline(i))!=0: print my_file.readline(i) i+=1 my_file.close()
what i think it should output:
I'm the first line of the file!
I'm the second line.
Third line here, boss.
what is getting output:
i think the argument might be number of characters