Seek and Tell Functions
Seek and Tell Functions
seek()
tell()
RECGRDED WiH
SCREENCAST MATIC
seek()
seek() function is used to change the position of the file
handle (file pointer) to a given specific position.
File pointer is like acursor, which defines from where the
data has to be read or written in the file.
Syntax :
f.seek(offset, from_what)
#where f is file pointer
RECGRDEO WiH
SCREENCASTO MATIC
seek()
The reference point is defined by the "from_what"
argument. It can have any of the three values:
0: sets the reference point at the beginning of the file,
which is by default.
1: sets the reference point at the current file position.
2: sets the reference point at the end of the file.
But, in Python 3.x and above, we can seek from
only, if openedin text mode. We can overcome
by opening the file in b mode.
RECORDED WiTH
SCREENCAST MATIC
seek()
The reference point is defined by the "from wha
argument. It can have any of the three values:
0: sets the reference point at the beginning of the file,
which is by default.
1: sets the reference point at the current file position.
2: sets the reference point at the end of the file.
But, in ython 3.x and above, we can seek from beginning
only, if opened in text mode. We can overcome from this
byopening the file in b mode.
RECGRDED WiTH
2007
34-05-208
ython i45 Sel
e fdt Shel Debug Csbona Window belp
SCREEICASTMATc 2013
2645-70
Fie Edt fomat un Ogtionu Window Hep
SCREEISTtC 2011
34-95-2039
te tat She Dbug pbons Wndow belp
SSREEIGSTMEO 2015
645-37
Le demagy-CUertaoryAppatakocat PrograPythonython-1Ndemopy(45
Fe tdt fomt un Ggtont Window Help
SCREESISTMAC 2016
3445-03