从python cgi中删除文件 [英] delete file from python cgi

查看:44
本文介绍了从python cgi中删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个python脚本,我想在我的电脑上删除一个文件

c:\ .... \ ... \ ..。txt脚本是什么去做这个?我知道如何写文件

但我还需要知道如何删除文件。

I have a python script and i want to delete a file on my computer
c:\....\...\.. .txt what''s the script to do this? I know how to write
to files but i also need to know how to delete a file.

推荐答案

没有直接与cgi连接...


import os

os.remove(" /path/to/your/file.txt")


--Gilles

No direct connection with cgi...

import os
os.remove("/path/to/your/file.txt")

--Gilles


lamar_air写道:
lamar_air wrote:
我有一个python脚本,我想要删除我的电脑上的文件
c:\ .... \ ... \ ..。txt脚本是做什么的?我知道如何写文件,但我也需要知道如何删除文件。
I have a python script and i want to delete a file on my computer
c:\....\...\.. .txt what''s the script to do this? I know how to write
to files but i also need to know how to delete a file.




os.unlink()或os.remove() 。他们是一样的。


- Gerhard



os.unlink() or os.remove(). They''re the same.

-- Gerhard


我有一个解压缩一些zip文件的程序。解压缩后,

我想用os.remove删除zip文件,但是我收到了这个错误:

OSError:[Errno 13]权限被拒绝:... 。

我该怎么办?


谢谢,
I have a program that unzip some zip files. After unzipping them,
I want to delete the zip files with os.remove, but I get this error:
OSError: [Errno 13] Permission denied: ....
What can I do?

Thanks,


这篇关于从python cgi中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆