A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/os_tempnam.htm below:

Python os.tempnam() Method

Python os.tempnam() Method

Python method tempnam() returns a unique path name that is reasonable for creating a temporary file.

With the release of Python 3.0 version, the os.tempnam() method has been deprecated.
Syntax

Following is the syntax for Python os.tempnam() method −

os.tempnam(dir, prefix)
Parameters

The Pythonos.tempnam() accepts the following parameters −

Return Value

The Python os.tempnam() method returns a unique path.

Example

The following example shows the usage of tempnam() method.

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 above program, it produces following result −

This is the unique path:
/tmp/tutorialsdir/tuts1IbAco8

os_file_methods.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4