Files and functions _ Retrieving the second or third line output
From the underlining code. After obtaining the first line output. Going further, how do you retrieve the second or third line.
f = open('kipling.txt','r')
Let me make use of the
content variable that Giles defines at 7:55. If you want to obtain the variables line by line, you can iterate through that variable in, for example, the following way:
for i in content: print(i)
If you want a specific line, then you can type
print(content[# your index #])
where you replace
# your index # with the index of the line that you want to print out.
Hope this helps!