Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 903d76c

Browse files
committed
Open
1 parent 69744c8 commit 903d76c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ while True:
884884
**Opens file and returns a corresponding file object.**
885885

886886
```python
887-
<file> = open(<path>, mode='r', encoding=None)
887+
<file> = open(<path>, mode='r', encoding=None, newline=None)
888888
```
889889

890890
#### Modes:
@@ -898,6 +898,20 @@ while True:
898898
* `'b'` - binary mode
899899
* `'t'` - text mode (default)
900900

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+
901915
#### Read Text from File:
902916
```python
903917
def read_file(filename):

0 commit comments

Comments
 (0)