Q. Considering the two files p1.txt and p2.txt created in previous question, what output will be produced by following code fragments ?
(a)
obj1 = open("p1.txt", "r")
s1 = obj1.readline()
s2= obj1.read(15)
print (s2)
obj1.close()
(b)
obj1 = open("p2.txt", "r")
s1 = obj1.readline()
s2 = obj1.read(15)
print(s2)
obj1.close()
Answer :-
No output or blank output will be produced by code (a).
For code(b), the output produced will be:
Better than Hea
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )