[英]/tmp directory clean up after python script execution
I am using python and invoking external utility "send-data" in my .py file as shown below, 我正在使用python并在.py文件中调用外部实用程序“ send-data”,如下所示,
cmd=['send-data', '-f', file_name]
res = subprocess.run(cmd,stdout=subprocess.PIPE, input=b'a')
I have no control over send-data utility and it creates file under /tmp directory with random name as shown below in the response string. 我无法控制send-data实用程序,它会在/ tmp目录下使用随机名称创建文件,如响应字符串所示。
'a)bort, e)dit or s)end? send-data: the file remains in /tmp/pbadLWX .'
Wondering how can i delete the file "pbadLWX" under /tmp folder after each execution? 想知道每次执行后如何删除/ tmp文件夹下的文件“ pbadLWX”? Considering every time file name could be different?
考虑每次文件名都可以不同吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.