Create a test.txt file and add the below content to it.
test.txt file:
line1 line2 line3 line4 line5 line6 line7
Solution:
# read file with open("test.txt", "r") as fp: # read all lines from a file lines = fp.readlines() # get line number 3 print(lines[2])
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer