Advertisements
Advertisements
प्रश्न
Write the use and syntax for the following method:
seek()
टिप्पणी लिखिए
Advertisements
उत्तर
seek() method is used to position the file object at a particular position in a file.
The syntax of seek() is
file_object.seek(offset [, reference_point])
In the above syntax, offset is the number of bytes by which the file object is to be moved.
reference_point indicates the starting position of the file object. That is, with reference to which position, the offset has to be counted. It can have any of the following values:
0 – beginning of the file
1 – current position of the file
2 – end of file
By default, the value of reference_point is 0, i.e. the offset is counted from the beginning of the file.
shaalaa.com
Setting Offsets in a File in python
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
