YouTip LogoYouTip

Os Tmpnam

# Python2.x Python os.tmpnam() Method [![Image 3: Python File Methods](#) 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 [![Image 4: Python File Methods](#) Python OS File/Directory Methods](#)
← Os WalkOs Tcgetpgrp β†’