Browse Source

File

pull/28/head
Jure Šorn 6 years ago
parent
commit
d9464bb1de
1 changed files with 16 additions and 4 deletions
  1. 20
      README.md

20
README.md

@ -1070,11 +1070,23 @@ Open
* **`'t'` - Text mode (default).**
* **`'b'` - Binary mode.**
### Seek
### File
```python
<file>.seek(0) # Move to the start of the file.
<file>.seek(offset) # Move 'offset' chars/bytes from the start.
<file>.seek(offset, <anchor>) # Anchor: 0 start, 1 current pos., 2 end.
<file>.seek(0) # Move to the start of the file.
<file>.seek(offset) # Move 'offset' chars/bytes from the start.
<file>.seek(offset, <anchor>) # Anchor: 0 start, 1 current pos., 2 end.
```
```python
<str/bytes> = <file>.read(size=-1) # Reads 'size' chars/bytes or until EOF.
<str/bytes> = <file>.readline() # Returns a line.
<list> = <file>.readlines() # Returns a list of lines.
<str/bytes> = next(<file>) # Returns a line using buffer. Do not mix.
```
```python
write(<str/bytes>) # Writes a string or bytes object.
writelines(<list>) # Writes a list of strings or bytes objects.
```
### Read Text from File

Loading…
Cancel
Save