Python method tempnam() returns a unique path name that is reasonable for creating a temporary file.
Following is the syntax for tempnam() method:
This method returns a unique path.
The following example shows the usage of tempnam() method.
# !/usr/bin/python import os, sys # prefix is tuts1 of the generated file tmpfn = os.tempnam('/tmp/tutorialsdir,'tuts1') print "This is the unique path:" print tmpfn
When we run the above program, it produces the following result:
This is the unique path: /tmp/tutorialsdir/tuts1IbAco8
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.