Python tempfile 临时文件流

import tempfile

_file_data = bytes('文件数据')
_temp_file = tempfile.NamedTemporaryFile()
_temp_file.write(_file_data)

# 保存
_temp_file.flush()

# 指针指向文件开头
_temp_file.seek(0)


posted @ 2022-06-30 13:21  太晓  阅读(48)  评论(0编辑  收藏  举报