From 903d76c08b7035a0b10e6335d0c0573966da9d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 1 Feb 2019 18:58:20 +0100 Subject: [PATCH] Open --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c59ed2..a79cf6e 100644 --- a/README.md +++ b/README.md @@ -884,7 +884,7 @@ while True: **Opens file and returns a corresponding file object.** ```python - = open(, mode='r', encoding=None) + = open(, mode='r', encoding=None, newline=None) ``` #### Modes: @@ -898,6 +898,20 @@ while True: * `'b'` - binary mode * `'t'` - text mode (default) +#### Newline - input: +* `None` - Input is broken on '\n', '\r' and '\r\n'. '\r' and '\r\n' are translated to '\n'. +* `''` - Input is broken on '\n', '\r' and '\r\n'. +* `'\n'` - Input is broken on '\n'. +* `'\r'` - Input is broken on '\r'. +* `'\r\n'` - Input is broken on '\r\n'. + +#### Newline - output: +* `None` - Any '\n' is translated to system default line separator. +* `''` - No translation. +* `'\n'` - No translation. +* `'\r'` - Any '\n' is translated to '\r'. +* `'\r\n'` - Any '\n' is translated to '\r\n' + #### Read Text from File: ```python def read_file(filename):