Assume that demofile.txt contains the following text: This is the first line. This is the second line.
Question:
Assume that "demofile.txt" contains the following text:
This is the first line.
This is the second line.
This is the third line.
This is the fourth line.
This file is for testing purposes.
Write Python statements to do the following:
f = open("demofile.txt", "r")
line1 = _______________________ # to read the first line
line2 = _______________________ # to read the second line
line3 = _______________________ # to read the remaining content
10. Complete the for loop in the following code to print the lines of "myfile.txt"
f = open ("myfile.txt", "r")
for ____________________________________:
print(line)
11. What is the difference between write()and writelines()
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill