Python method tmpnam() returns a unique path name that is reasonable for creating a temporary file.
Following is the syntax for tmpnam() method −
This method returns a unique path name.
The following example shows the usage of tmpnam() method.
# !/usr/bin/python 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