python创建临时文件夹的方法

python创建临时文件夹的方法,第1张

python创建临时文件夹的方法

本文实例讲述了python创建临时文件夹的方法。分享给大家供大家参考。具体实现方法如下:

import tempfile, os 
tempfd, tempname = tempfile.mkstemp('.suffix') 
os.write(tempfd, "aString")
# or, if you want a file-object: os.fdopen(tempfd, 'w+') 
os.close(tempfd) 
os.unlink(tempname) 

希望本文所述对大家的Python程序设计有所帮助。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/3327088.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-10-06
下一篇2022-10-06

发表评论

登录后才能评论

评论列表(0条)

    保存