ftp的例子也很簡單,主要是引入lib,下面是互動模式下的乙個例子
>>> from ftplib import ftp
>>> f=ftp('10.10.231.17')
>>> f.login('root','123456')
traceback (most recent call last):
file "", line 1, in 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()
Python Socket 程式設計
client import socket,sys if name main 處理引數 argv sys.argv if len argv 3 or len argv 2 and argv 1 print useage argv 0 sys.exit 0 host argv 1 server ip位址...
python socket程式設計
python 編寫server的步驟 1.第一步是建立socket物件。呼叫socket建構函式。如 socket socket.socket family,type family引數代表位址家族,可為af inet或af unix。af inet家族包括internet位址,af unix家族用於...
python socket程式設計
客戶端 author lenovo fromsocketimport host localhost port 2157 bufsize 1024 addr host,port tcpclient socket af inet,sock stream tcpclient.connect addr wh...