O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

tempfile

The tempfile module is used to generate temporary filenames and files.

mkdtemp([suffix [,prefix [,dir]]])

Creates a temporary directory accessible only by the owner of the calling process and returns its absolute pathname. suffix is an optional suffix that will be appended to the directory name, prefix is an optional prefix that will be inserted at the beginning of the directory name, and dir is a directory where the temporary directory should be created.

mkstemp([suffix [,prefix [, dir [,text]]]])

Creates a temporary file and returns a tuple (fd, pathname) where fd is an integer file descriptor returned by os.open() and pathname is absolute pathname of the file. suffix is an optional suffix appended to the filename, prefix is an optional ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required