Python3 os.tmpnam () method
Python3 OS file / directory methods
Outline
os.tmpnam () method is used to create a temporary file returns a unique path.
grammar
tmpnam () method syntax is as follows:
os.tmpnam
parameter
no
return value
Returns a unique path.
Examples
The following example demonstrates tmpnam () method of use:
#!/usr/bin/python3 import os, sys # 生成临时路径 tmpfn = os.tmpnam() print ("这是一个唯一的路径:") print (tmpfn)
The above program output is:
这是一个唯一的路径: /tmp/fileUFojpd