Q. Consider the file 'poemBTH.txt' given above (in previous question). What output will be produced by following code fragment?
obj1 = open('poemBTH.txt', 'r')
s1 = obj1.readline()
s2.readline(10)
s3 = obj1.read(15)
print(s3)
print(obj1.readline())
obj1.close()
Answer = It will print error that ‘s2’ is not defined.
If you want any output then write code given below in python and make poemBTH.txt in same directory :-
obj1 = open('Pathwalla.txt', 'r') s1 = obj1.readline() s2 = obj1.readline(10) s3 = obj1.read(15) print(s3) print(obj1.readline()) obj1.close()
If code is correct then
ReplyDeletewhat is the output?
It will give Error s2 is not defined .
Deletegod made the ea
Deletegod mmade the earth
If s2 is defined what is the output?
ReplyDeleteI have given the bellow code copy it and run it .
Deletegopal
ReplyDeletepathwala
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )