diff options
author | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
commit | 48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (patch) | |
tree | 04c86b387c11bfd4835a320e76bbb2ee24626e0d /Doc/tutorial/errors.rst | |
parent | 3d3558a4653fcfcbdcbb75bda5d61e93c48f4d51 (diff) | |
download | cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.zip cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.gz cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.bz2 |
Remove trailing whitespace.
Diffstat (limited to 'Doc/tutorial/errors.rst')
-rw-r--r-- | Doc/tutorial/errors.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index ca70f89..e78947c 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -91,7 +91,7 @@ is signalled by raising the :exc:`KeyboardInterrupt` exception. :: ... break ... except ValueError: ... print("Oops! That was no valid number. Try again...") - ... + ... The :keyword:`try` statement works as follows. @@ -195,12 +195,12 @@ indirectly) in the try clause. For example:: >>> def this_fails(): ... x = 1/0 - ... + ... >>> try: ... this_fails() ... except ZeroDivisionError as err: ... print('Handling run-time error:', err) - ... + ... Handling run-time error: int division or modulo by zero @@ -251,12 +251,12 @@ directly or indirectly. For example:: ... self.value = value ... def __str__(self): ... return repr(self.value) - ... + ... >>> try: ... raise MyError(2*2) ... except MyError as e: ... print('My exception occurred, value:', e.value) - ... + ... My exception occurred, value: 4 >>> raise MyError('oops!') Traceback (most recent call last): @@ -326,7 +326,7 @@ example:: ... raise KeyboardInterrupt ... finally: ... print('Goodbye, world!') - ... + ... Goodbye, world! Traceback (most recent call last): File "<stdin>", line 2, in ? @@ -389,9 +389,9 @@ and print its contents to the screen. :: print(line) The problem with this code is that it leaves the file open for an indeterminate -amount of time after this part of the code has finished executing. -This is not an issue in simple scripts, but can be a problem for larger -applications. The :keyword:`with` statement allows objects like files to be +amount of time after this part of the code has finished executing. +This is not an issue in simple scripts, but can be a problem for larger +applications. The :keyword:`with` statement allows objects like files to be used in a way that ensures they are always cleaned up promptly and correctly. :: with open("myfile.txt") as f: |