File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1070,11 +1070,23 @@ Open
1070
1070
* ** ` 't' ` - Text mode (default).**
1071
1071
* ** ` 'b' ` - Binary mode.**
1072
1072
1073
- ### Seek
1073
+ ### File
1074
1074
``` 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.
1078
1090
```
1079
1091
1080
1092
### Read Text from File
You can’t perform that action at this time.
0 commit comments