python Socket编程(四)----FTP

ftp的例子也很简单,主要是引入lib,下面是交互模式下的一个例子
>>> from ftplib import FTP
>>> f=FTP('10.10.231.17')
>>> f.login('root','123456')
Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    f.login('root','123456')
  File "C:\Python27\lib\ftplib.py", line 377, in login
    resp = self.sendcmd('USER ' + user)
  File "C:\Python27\lib\ftplib.py", line 244, in sendcmd
    return self.getresp()
  File "C:\Python27\lib\ftplib.py", line 219, in getresp
    raise error_perm, resp
error_perm: 530 Permission denied.
>>> f.login('anonymous','123456')
'230 Login successful.'
>>> f.dir()
drwxr-xr-x    2 0        0            4096 May 13  2009 pub
>>> f.quit()


你可能感兴趣的:(socket编程)