File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,26 +242,26 @@ Here are some examples of typical usage of the :mod:`tempfile` module::
242242
243243 # create a temporary file and write some data to it
244244 >>> fp = tempfile.TemporaryFile()
245- >>> fp.write('Hello world!')
245+ >>> fp.write(b 'Hello world!')
246246 # read data from file
247247 >>> fp.seek(0)
248248 >>> fp.read()
249- 'Hello world!'
249+ b 'Hello world!'
250250 # close the file, it will be removed
251251 >>> fp.close()
252252
253253 # create a temporary file using a context manager
254254 >>> with tempfile.TemporaryFile() as fp:
255- ... fp.write('Hello world!')
255+ ... fp.write(b 'Hello world!')
256256 ... fp.seek(0)
257257 ... fp.read()
258- 'Hello world!'
258+ b 'Hello world!'
259259 >>>
260260 # file is now closed and removed
261261
262262 # create a temporary directory using the context manager
263263 >>> with tempfile.TemporaryDirectory() as tmpdirname:
264- ... print 'created temporary directory', tmpdirname
264+ ... print( 'created temporary directory', tmpdirname)
265265 >>>
266266 # directory and contents have been removed
267267
Original file line number Diff line number Diff line change @@ -257,6 +257,11 @@ Tests
257257- Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due
258258 to open door files.
259259
260+ Documentation
261+ -------------
262+
263+ - Issue #11818: Fix tempfile examples for Python 3.
264+
260265
261266What's New in Python 3.2?
262267=========================
You can’t perform that action at this time.
0 commit comments