如何使用ftplib?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

如何使用ftplib?

fuyu0123456789
Hi 各位:
 
请问如何使用FTP类的connect方法,试了几次老是报错。
我想连接的port是2198。
 
哪位了解的话,给个例程看看啊。
 
connect( host[, port])
Connect to the given host and port. The default port number is 21, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called at all if a host was given when the instance was created. All other methods can only be used after a connection has been made.



网 易 有 道 词 典 -- 全 球 最 强 大 的 免 费 英 汉 互 译 词 典 ( 只 有 2 兆 )
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何使用ftplib?

Weimin Li

以前在产线工作的时候也常要上传下载data啥的,呼呼. ftplibobject不是很丰富 如果可以的话,建议你可以把ftp的路径先映射成一个driver,那样对driver操作的话可以有更多module使用的.

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of fuyu0123456789
Sent: Monday, January 07, 2008 3:14 PM
To: python-chinese
Subject: [python-chinese]
如何使用ftplib

 

Hi 各位:

 

请问如何使用FTP类的connect方法,试了几次老是报错。

我想连接的port2198

 

哪位了解的话,给个例程看看啊。

 

connect(

host[, port])

Connect to the given host and port. The default port number is 21, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called at all if a host was given when the instance was created. All other methods can only be used after a connection has been made.




-- 有 2


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: 如何使用ftplib?

zhen zhou-3
In reply to this post by fuyu0123456789
错误信息?

看帮助啊。

[zhouzhen@v4 smb]$ python
Python 2.5 (r25:51908, Jul 13 2007, 11:45:39)
[GCC 3.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ftplib import FTP
>>> ftp = FTP()
>>> ftp.connect( 'www.xxx.net', 21 )
'220  ^-^ Welcome to UnixNIC[Ux04][TLS], FTPd Server Ready.^-^'
>>>


在08-1-7,fuyu0123456789 <[hidden email]> 写道:
Hi 各位:
 
请问如何使用FTP类的connect方法,试了几次老是报错。
我想连接的port是2198。
 
哪位了解的话,给个例程看看啊。
 
connect( host[, port])
Connect to the given host and port. The default port number is 21, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called at all if a host was given when the instance was created. All other methods can only be used after a connection has been made.



<a style="font-size: 14px; line-height: 15px; color: rgb(0, 0, 0); text-decoration: none;" href="http://event.mail.163.com/chanel/click.htm?from=NO_25&amp;domain=163" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> 网 易 有 道 词 典 -- 全 球 最 强 大 的 免 费 英 汉 互 译 词 典 ( 只 有 2 兆 )
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank"> http://python.cn/mailman/listinfo/python-chinese



--
zhouzhen

http://www.6code.net
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

知道了。如何使用ftplib?

fuyu0123456789
原来应该这样:
 
from ftplib import FTP
my_ftp = FTP()
my_ftp.connect('*********',2198)
my_ftp.login('**','**')
 
 
 

在2008-01-07,[hidden email] 写道:
错误信息?

看帮助啊。

[zhouzhen@v4 smb]$ python
Python 2.5 (r25:51908, Jul 13 2007, 11:45:39)
[GCC 3.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ftplib import FTP
>>> ftp = FTP()
>>> ftp.connect( 'www.xxx.net', 21 )
'220  ^-^ Welcome to UnixNIC[Ux04][TLS], FTPd Server Ready.^-^'
>>>


在08-1-7,fuyu0123456789 <[hidden email]> 写道:
Hi 各位:
 
请问如何使用FTP类的connect方法,试了几次老是报错。
我想连接的port是2198。
 
哪位了解的话,给个例程看看啊。
 
connect( host[, port])
Connect to the given host and port. The default port number is 21, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called at all if a host was given when the instance was created. All other methods can only be used after a connection has been made.



<A style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 15px; TEXT-DECORATION: none" href="http://event.mail.163.com/chanel/click.htm?from=NO_25&amp;domain=163" target="_blank" on_click="return top.js.OpenExtLink(window,event,this)">网 易 有 道 词 典 -- 全 球 最 强 大 的 免 费 英 汉 互 译 词 典 ( 只 有 2 兆 )
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <A href="http://python.cn/mailman/listinfo/python-chinese" target="_blank" on_click="return top.js.OpenExtLink(window,event,this)">http://python.cn/mailman/listinfo/python-chinese



--
zhouzhen

http://www.6code.net



网 易 有 道 词 典 -- 全 球 最 强 大 的 免 费 英 汉 互 译 词 典 ( 只 有 2 兆 )
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese