summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py5
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: