From 92a4c1ab0aa8e4c1c452c2ee33c8d9d3c5ac08d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 8 Jul 2019 22:40:40 +0200 Subject: [PATCH] Open --- README.md | 6 +++++- index.html | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3cb06d9..fe9bb3d 100644 --- a/README.md +++ b/README.md @@ -1429,7 +1429,7 @@ value = args. Open ---- -**Opens a file and returns a corresponding file object or raises 'FileNotFoundError'.** +**Opens a file and returns a corresponding file object.** ```python = open('', mode='r', encoding=None, newline=None) @@ -1449,6 +1449,10 @@ Open * **`'t'` - Text mode (default).** * **`'b'` - Binary mode.** +### Exceptions +* **`'FileNotFoundError'` can be risen when reading with `'r'` or `'r+'`.** +* **`'FileExistsError'` can be risen when writing with `'x'`.** + ### File ```python .seek(0) # Moves to the start of the file. diff --git a/index.html b/index.html index 3b4134c..7b1e401 100644 --- a/index.html +++ b/index.html @@ -1307,7 +1307,7 @@ value = args.<name>
  • Use 'type=FileType(<mode>)' for files.
  • #Open

    -

    Opens a file and returns a corresponding file object or raises 'FileNotFoundError'.

    +

    Opens a file and returns a corresponding file object.

    <file> = open('<path>', mode='r', encoding=None, newline=None)
     
      @@ -1327,6 +1327,11 @@ value = args.<name>
    • 't' - Text mode (default).
    • 'b' - Binary mode.
    +

    Exceptions

    +
      +
    • 'FileNotFoundError' can be risen when reading with 'r' or 'r+'.
    • +
    • 'FileExistsError' can be risen when writing with 'x'.
    • +

    File

    <file>.seek(0)                      # Moves to the start of the file.
     <file>.seek(offset)                 # Moves 'offset' chars/bytes from the start.
    @@ -1809,7 +1814,7 @@ logger.<level>('A logging message.')
     
    • Levels: 'debug', 'info', 'success', 'warning', 'error', 'critical'.
    -

    Exceptions

    +

    Exceptions

    Error description, stack trace and values of variables are appended automatically.

    try:
         ...