Python file methods
- Forrige Side Python Samlingsmetoder
- Næste Side Python Nøgleord
Python has a set of methods that can be used for file objects.
Method | Description |
---|---|
close() | Close the file. |
detach() | Return a 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() | Ændr filpositionen. |
seekable() | Returnerer om filen er tilladt at ændre filpositionen. |
tell() | Returnerer den nuværende filposition. |
truncate() | Juster filen til den specificerede størrelse. |
writeable() | Returnerer om det er muligt at skrive til filen. |
write() | Skriv den angivne streng til filen. |
writelines() | Skriv strenglisten til filen. |
På vores Python Filhåndtering Læringsvejledning Lær mere om filobjekter.
- Forrige Side Python Samlingsmetoder
- Næste Side Python Nøgleord