Correct option is D
In Python, the
seek() method is used to move the file pointer to a specific position in a file. This allows you to start reading from any position in the file, not necessarily from the beginning.
Important Key Points:
1.
seek(): This method sets the file pointer at a specified position in the file. It takes an argument (the position) and optionally a second argument to specify the reference point (e.g., from the beginning, from the current position, or from the end).
·
Example: file.seek(10) moves the pointer to the 10th byte in the file.
2.
tell(): This method is used to get the current position of the file pointer, not to move it.
3.
find(): This method is used to search for a substring in a string, not for file handling.
4.
move: There is no move() method for file pointers in Python. The correct method for repositioning is seek().
Knowledge Booster:
·
Option (a):
move is not a valid method in Python for file handling.
·
Option (b):
tell() gives the current file pointer position, but it does not move the pointer. It is used to check where the pointer currently is in the file.
·
Option (c):
find() is a method used for searching in strings, not for moving the file pointer.