Python file methods

Python has a set of methods that can be used for file objects.

Method Description
close() Close the file.
detach() Return the separated raw stream (raw stream) from the buffer.
fileno() Return the numeric representation of the stream from the perspective of the operating system.
flush() Flush the internal buffer.
isatty() Return whether the file stream is interactive.
read() Return the content of the file.
readable() Return whether the file stream can be read.
readline() Return a single line from the file.
readlines() Return the list of lines in the file.
seek() I-baguhin ang posisyon ng file.
seekable() I-balik kung ang file ay pinapayagan namin na baguhin ang posisyon ng file.
tell() I-balik ang kasalukuyang posisyon ng file.
truncate() I-ayos ang laki ng file sa tinukoy na laki.
writeable() I-balik kung puwede nating i-write sa file.
write() I-write ang tinukoy na string sa file.
writelines() I-write ang listahan ng string sa file.

Sa aming Tutubos ng Python sa Pamamahala ng File Matuto ng higit pa tungkol sa file object.