相关疑难解决方法(0)

从tempfile创建和读取

无论如何我可以写入tempfile并将其包含在命令中,然后关闭/删除它.我想执行命令,例如:some_command/tmp/some-temp-file.
提前谢谢了.

import tempfile
temp = tempfile.TemporaryFile()
temp.write('Some data')
command=(some_command temp.name)
temp.close()
Run Code Online (Sandbox Code Playgroud)

python

45
推荐指数
3
解决办法
7万
查看次数

标签 统计

python ×1