What will be the output of the following code?
f=open("demo.txt","r") print(f.tell())
निम्नलिखित कोड का आउटपुट क्या होगा?
In the seek() method of a file object in Python, the offset parameter is the number of bytes to move the file pointer, and the optional reference_point parameter indicates the reference point or the position from where the offset should be measured. The reference_point parameter is optional, and if not provided, it defaults to the beginning of the file (offsets are measured from the beginning).
The reference_point parameter can take one of the following values:
What will be the output of the following code ?
f=open("demo.txt","w+") f.write("Welcome to python") f.seek(5) a=f.read(5) print(a)
निम्नलिखित कोड का आउटपुट क्या होगा ?
In Python, the readlines() method is a method used with file objects. It reads all the lines in a file and returns them as a list of strings. Each element in the list corresponds to a line in the file.