diff options
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 5a5a481..292aa46 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1426,9 +1426,8 @@ def tempfilepager(text, cmd): """Page through text by invoking a program on a temporary file.""" import tempfile filename = tempfile.mktemp() - file = open(filename, 'w') - file.write(text) - file.close() + with open(filename, 'w') as file: + file.write(text) try: os.system(cmd + ' "' + filename + '"') finally: |