Python File (File) method
file functions to create objects using open, the following table lists the file objects commonly used functions:
No. | Method and Description |
---|---|
1 | Close the file. Close the file can no longer read and write operations. |
2 | Internal refresh file buffering, the data directly to the internal buffer written to the file immediately, rather than passively waiting for output buffer written. |
3 | Return an integer file descriptor (file descriptor FD integer), it can be used in such a method os module read some of the underlying operations. |
4 | If the file is connected to a terminal device returns True, otherwise False. |
5 | Returns the file the next line. |
6 | Reads the specified number of bytes from the file, if not given or is negative read all. |
7 | Read the entire line, including the "\ n" character. |
8 | Read all rows and return a list, if given sizeint> 0, returns the sum of approximately sizeint byte row of the actual read value may be higher than sizhint larger, because of the need to fill the buffer. |
9 | Current position settings file |
10 | Returns the current file position. |
11 | Intercept file intercepted by byte size specified, it defaults to the current file position. |
12 | The string to the file, there is no return value. |
13 | Write a list of strings to the file sequence, if you need to change the line will have its own line breaks added for each row. |