Python os.tmpnam() 方法
Python 教程
· 2019-02-04 13:11:36
概述
os.tmpnam() 方法用于为创建一个临时文件返回一个唯一的路径。
语法
tmpnam()方法语法格式如下:
os.tmpnam
参数
无
返回值
返回一个唯一的路径。
实例
以下实例演示了 tmpnam() 方法的使用:
#!/usr/bin/python # -*- coding: UTF-8 -*- import os, sys # 生成临时路径 tmpfn = os.tmpnam() print "这是一个唯一的路径:" print tmpfn
执行以上程序输出结果为:
这是一个唯一的路径: /tmp/fileUFojpd
点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html
Programming PHP
Rasmus Lerdorf、Kevin Tatroe、Peter MacIntyre / O'Reilly Media / 2006-5-5 / USD 39.99
Programming PHP, 2nd Edition, is the authoritative guide to PHP 5 and is filled with the unique knowledge of the creator of PHP (Rasmus Lerdorf) and other PHP experts. When it comes to creating websit......一起来看看 《Programming PHP》 这本书的介绍吧!