橘子味的心
标题:Python3 os 模块 Tmpfile 方法

Python3 os 模块 Tmpfile 方法

# !/usr/bin/python3
import os

# The file has no directory entries associated with it and will be

# deleted automatically once there are no file descriptors.
tmpfile = os.tmpfile()
tmpfile.write('Temporary newfile is here.....')
tmpfile.seek(0)

print tmpfile.read()
tmpfile.close

目录

分类