File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -884,7 +884,7 @@ while True:
884
884
** Opens file and returns a corresponding file object.**
885
885
886
886
``` python
887
- < file > = open (< path> , mode = ' r' , encoding = None )
887
+ < file > = open (< path> , mode = ' r' , encoding = None , newline = None )
888
888
```
889
889
890
890
#### Modes:
@@ -898,6 +898,20 @@ while True:
898
898
* ` 'b' ` - binary mode
899
899
* ` 't' ` - text mode (default)
900
900
901
+ #### Newline - input:
902
+ * ` None ` - Input is broken on '\n', '\r' and '\r\n'. '\r' and '\r\n' are translated to '\n'.
903
+ * ` '' ` - Input is broken on '\n', '\r' and '\r\n'.
904
+ * ` '\n' ` - Input is broken on '\n'.
905
+ * ` '\r' ` - Input is broken on '\r'.
906
+ * ` '\r\n' ` - Input is broken on '\r\n'.
907
+
908
+ #### Newline - output:
909
+ * ` None ` - Any '\n' is translated to system default line separator.
910
+ * ` '' ` - No translation.
911
+ * ` '\n' ` - No translation.
912
+ * ` '\r' ` - Any '\n' is translated to '\r'.
913
+ * ` '\r\n' ` - Any '\n' is translated to '\r\n'
914
+
901
915
#### Read Text from File:
902
916
``` python
903
917
def read_file (filename ):
You can’t perform that action at this time.
0 commit comments