Os Tmpnam
# Python2.x Python os.tmpnam() Method
[ Python OS File/Directory Methods](#)
* * *
### Overview
The os.tmpnam() method returns a unique path for creating a temporary file.
### Syntax
The syntax for the **tmpnam()** method is as follows:
os.tmpnam
### Parameters
* None
### Return Value
Returns a unique path.
### Example
The following example demonstrates the use of the tmpnam() method:
#!/usr/bin/python# -*- coding: UTF-8 -*-import os, sys # Generate temporary path tmpfn = os.tmpnam()print "This is a unique path:"print tmpfn
The output of the above program is:
This is a unique path:/tmp/fileUFojpd
[ Python OS File/Directory Methods](#)
YouTip