(a) F.seek(1,0) (b) F.seek(0,1) (c) F.seek(0,-1) (d) F.seek(0,2)
The syntax of seek( ) is : file_object.seek(offset[, reference_point])What is the default value of reference_point ? [1 Mark] [2023]
(a) 0 (b) 1 (c) 2 (d) 3
(a) r+ (b) r (c) w (d) a
Example : If the file content is as follows : On seat2 VIP1 will sit and On seat1 VVIP2 will be sitting Output will be : Number of words ending with a digit are 4
def count_Dwords(): f=open("demo.txt","r") s=f.read() L=s.split() count=0 for i in L: if i[-1] in '0123456789': count=count+1 print("Number of words ending with a digit are",count) f.close() count_Dwords()
For Example, if the content of 'Lines.txt' is as follows : Once upon a time, there was a woodcutter He lived in a little house in a beautiful, green wood. One day, he was merrily chopping some wood. He saw a little girl skipping through the woods, whistling happily. The girl was followed by a big gray wolf. Then the function should display output as : He lived in a little house in a beautiful, green wood. He saw a little girl skipping through the woods, whistling happily.
def LongLines(): f=open("Lines.txt","r") L=f.readlines() for i in L: x=i.split() if len(x)>=10: print(i,end='') f.close() LongLines()