Python os.tmpnam() Method
Python method tmpnam() returns a unique path name that is reasonable for creating a temporary file.
The Python os.tmpnam() method has been deprecated.
Syntax
Following is the syntax for Python os.tmpnam() method −
os.tmpnam()
Parameters
The Python os.tmpnam() method does not accept any parameter.
Return Value
The Python os.tmpnam() method returns a unique path name.
Example
The following example shows the usage of tmpnam() method.
import os, sys
# Temporary file generated in current directory
tmpfn = os.tmpnam()
print ("This is the unique path:")
print (tmpfn)
When we run above program, it produces following result −
This is the unique path: /tmp/fileUFojpd
python_files_io.htm
Advertisements