Skip to content

Commit d9464bb

Browse files
committed
File
1 parent 78c74b3 commit d9464bb

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,11 +1070,23 @@ Open
10701070
* **`'t'` - Text mode (default).**
10711071
* **`'b'` - Binary mode.**
10721072

1073-
### Seek
1073+
### File
10741074
```python
1075-
<file>.seek(0) # Move to the start of the file.
1076-
<file>.seek(offset) # Move 'offset' chars/bytes from the start.
1077-
<file>.seek(offset, <anchor>) # Anchor: 0 start, 1 current pos., 2 end.
1075+
<file>.seek(0) # Move to the start of the file.
1076+
<file>.seek(offset) # Move 'offset' chars/bytes from the start.
1077+
<file>.seek(offset, <anchor>) # Anchor: 0 start, 1 current pos., 2 end.
1078+
```
1079+
1080+
```python
1081+
<str/bytes> = <file>.read(size=-1) # Reads 'size' chars/bytes or until EOF.
1082+
<str/bytes> = <file>.readline() # Returns a line.
1083+
<list> = <file>.readlines() # Returns a list of lines.
1084+
<str/bytes> = next(<file>) # Returns a line using buffer. Do not mix.
1085+
```
1086+
1087+
```python
1088+
write(<str/bytes>) # Writes a string or bytes object.
1089+
writelines(<list>) # Writes a list of strings or bytes objects.
10781090
```
10791091

10801092
### Read Text from File

0 commit comments

Comments
 (0)