summaryrefslogtreecommitdiffstats
path: root/Doc/library/tempfile.rst
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2011-04-10 07:30:04 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2011-04-10 07:30:04 (GMT)
commit810b94a36416cecf38205fd48e6a0a9eb3d2998c (patch)
tree3d708242f71e0cfc0b8aadadb7122db222c76a91 /Doc/library/tempfile.rst
parentdbb677a894b2d9da3945f7e3c0fdf850ea1bd3f1 (diff)
downloadcpython-810b94a36416cecf38205fd48e6a0a9eb3d2998c.zip
cpython-810b94a36416cecf38205fd48e6a0a9eb3d2998c.tar.gz
cpython-810b94a36416cecf38205fd48e6a0a9eb3d2998c.tar.bz2
Issue #11818: Fix tempfile examples for Python 3.
Diffstat (limited to 'Doc/library/tempfile.rst')
-rw-r--r--Doc/library/tempfile.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst
index 1e0a31f..01092fc 100644
--- a/Doc/library/tempfile.rst
+++ b/Doc/library/tempfile.rst
@@ -242,26 +242,26 @@ Here are some examples of typical usage of the :mod:`tempfile` module::
# create a temporary file and write some data to it
>>> fp = tempfile.TemporaryFile()
- >>> fp.write('Hello world!')
+ >>> fp.write(b'Hello world!')
# read data from file
>>> fp.seek(0)
>>> fp.read()
- 'Hello world!'
+ b'Hello world!'
# close the file, it will be removed
>>> fp.close()
# create a temporary file using a context manager
>>> with tempfile.TemporaryFile() as fp:
- ... fp.write('Hello world!')
+ ... fp.write(b'Hello world!')
... fp.seek(0)
... fp.read()
- 'Hello world!'
+ b'Hello world!'
>>>
# file is now closed and removed
# create a temporary directory using the context manager
>>> with tempfile.TemporaryDirectory() as tmpdirname:
- ... print 'created temporary directory', tmpdirname
+ ... print('created temporary directory', tmpdirname)
>>>
# directory and contents have been removed