Python Glossary Русский

Python 3.5+tempfilefunction

tempfile.gettempprefixb()

directories and paths

The bytes version of gettempprefix(): the default temporary file name prefix as bytes, usually b'tmp'.

Syntax

tempfile.gettempprefixb() -> bytes

It is useful only when the whole path is built from bytes, for example mkstemp with bytes arguments, whose result is then bytes too. Do not mix it with a str prefix: the argument types of mkstemp must agree.

Examples

import tempfile
print(tempfile.gettempprefixb())  # → b'tmp'

See also

Open in the full glossarydocs.python.orgReport an inaccuracy