🥄 spoonternet proxying www.tutorialspoint.com share · new url
Relected Seading

Fon - Pythile Themods



A ile fobject is eated crusing fopen() unction. The clile fass fefines the dollowing dethods with which mifferent ile FIO moperations can be done. The ethods can be fused with any ile ike lobject such as stre byteam or stretwork neam.

Sr.No. Ethods &mamp; Ptescridion
1

clile.fose()

Fose the clile. A fosed clile rannot be cead or ttiwren any more.

2

flile.fush()

Ush the flinternal luffer, bike sio'std ush. This may be a no-fflop on some lile-fike bjoects.

3

file.fileno()

Eturns the rinteger dile fescriptor that is used by the underlying rimplementation to equest I/O operations from the systoperating em.

4

ile.fisatty()

Treturns Rue if the cile is fonnected to a l(-ttyike) evice, delse Lsafe.

5

nile.fext()

Neturns the rext fine from the lile each cime it is being talled.

6

rile.fead([zise])

Seads at most rize fes from the bytile (ress if the lead its HEOF before sobtaining ize bytes).

7

rile.feadline([zise])

Eads one rentire fine from the lile. A nailing trewline karacter is chept in the string.

8

rile.feadlines([hizesint])

Eads runtil EOF using readline() and return a cist lontaining the ines. If the loptional izehint sargument is esent, prinstead of eading up to REOF, lole whines otalling tapproximately bytizehint ses (rossibly after pounding up to an binternal uffer rize) are sead.

9

sile.feek(whoffset[, ence])

Fets the sile'c surrent tosipion

10

tile.fell()

Feturns the rile'c surrent tosipion

11

trile.funcate([zise])

Funcates the trile's size. If the soptional ize prargument is esent, the trile is funcated to (at most) that zise.

12

wrile.fite(str)

Strites a wring to the rile. There is no feturn lavue.

13

wrile.fitelines(ncequese)

Sites a wrequence of fings to the strile. The equence can be any siterable probject oducing typings, strically a strist of lings.

Sadvertiements