diff options
author | Guido van Rossum <guido@python.org> | 1995-10-11 17:36:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-10-11 17:36:31 (GMT) |
commit | a61bdeb8a99585d51052e1e6f02d9883542daa59 (patch) | |
tree | d0e98f3057587109392d2a878c9ea4fc9ab78903 /Lib | |
parent | d9e9f9c05d705715826c84006054e7434a3c37ce (diff) | |
download | cpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.zip cpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.tar.gz cpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.tar.bz2 |
add delete() method to ftp object
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ftplib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 6a36df4..0dc0d6e 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -358,6 +358,16 @@ class FTP: raise error_reply, resp self.voidcmd('RNTO ' + toname) + # Delete a file + def delete(self, filename): + resp = self.sendcmd('DELE ' + filename) + if resp[:3] == '250': + return + elif resp[:1] == '5': + raise error_perm, resp + else: + raise error_reply, resp + # Change to a directory def cwd(self, dirname): if dirname == '..': |