tempfile.TemporaryFile()

tempfile.TemporaryFile(mode='w+b', buffering=None, encoding=None, newline=None, suffix=None, prefix=None, dir=None) Return a file-like object that can be used as a temporary storage area. The file is created securely, using the same rules as mkstemp(). It will be destroyed as soon as it is closed (including an implicit close when the object is garbage collected). Under Unix, the directory entry for the file is either not created at all or is removed immediately after the file is created. Oth

tempfile.TemporaryDirectory()

tempfile.TemporaryDirectory(suffix=None, prefix=None, dir=None) This function securely creates a temporary directory using the same rules as mkdtemp(). The resulting object can be used as a context manager (see Examples). On completion of the context or destruction of the temporary directory object the newly created temporary directory and all its contents are removed from the filesystem. The directory name can be retrieved from the name attribute of the returned object. When the returned ob

tempfile.gettempdirb()

tempfile.gettempdirb() Same as gettempdir() but the return value is in bytes. New in version 3.5.

tempfile.gettempprefix()

tempfile.gettempprefix() Return the filename prefix used to create temporary files. This does not contain the directory component.

tempfile.gettempprefixb()

tempfile.gettempprefixb() Same as gettempprefix() but the return value is in bytes. New in version 3.5.

tempfile.mktemp()

tempfile.mktemp(suffix='', prefix='tmp', dir=None) Deprecated since version 2.3: Use mkstemp() instead. Return an absolute pathname of a file that did not exist at the time the call is made. The prefix, suffix, and dir arguments are similar to those of mkstemp(), except that bytes file names, suffix=None and prefix=None are not supported. Warning Use of this function may introduce a security hole in your program. By the time you get around to doing anything with the file name it returns,

tempfile.mkstemp()

tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False) Creates a temporary file in the most secure manner possible. There are no race conditions in the file’s creation, assuming that the platform properly implements the os.O_EXCL flag for os.open(). The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by child processes. Un

tempfile.NamedTemporaryFile()

tempfile.NamedTemporaryFile(mode='w+b', buffering=None, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True) This function operates exactly as TemporaryFile() does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved from the name attribute of the returned file-like object. Whether the name can be used to open the file a second time, while the named temporary file is s

tempfile.mkdtemp()

tempfile.mkdtemp(suffix=None, prefix=None, dir=None) Creates a temporary directory in the most secure manner possible. There are no race conditions in the directory’s creation. The directory is readable, writable, and searchable only by the creating user ID. The user of mkdtemp() is responsible for deleting the temporary directory and its contents when done with it. The prefix, suffix, and dir arguments are the same as for mkstemp(). mkdtemp() returns the absolute pathname of the new directo

telnetlib.Telnet.write()

Telnet.write(buffer) Write a byte string to the socket, doubling any IAC characters. This can block if the connection is blocked. May raise OSError if the connection is closed. Changed in version 3.3: This method used to raise socket.error, which is now an alias of OSError.