Python论坛  - 讨论区

标题:[python-chinese] 如何使用ftplib?

2008年01月07日 星期一 15:13

fuyu0123456789 fuyu0123456789在163.com
星期一 一月 7 15:13:42 HKT 2008

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.
-------------- 涓嬩竴閮ㄥ垎 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20080107/289f58e1/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月07日 星期一 15:21

Weimin Li wli在sst.com
星期一 一月 7 15:21:56 HKT 2008

ÒÔÇ°ÔÚ²úÏß¹¤×÷µÄʱºòÒ²³£ÒªÉÏ´«ÏÂÔØdataɶµÄ,ºôºô. ftplibµÄobject²»ÊǺܷḻ Èç¹û¿ÉÒԵĻ°,½¨ÒéÄã¿ÉÒÔ°ÑftpµÄ·¾¶ÏÈÓ³Éä³ÉÒ»¸ödriver,ÄÇÑù¶Ôdriver²Ù×÷µÄ»°¿ÉÒÔÓиü¶àmoduleʹÓõÄ.

 

________________________________

From: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn] On Behalf Of fuyu0123456789
Sent: Monday, January 07, 2008 3:14 PM
To: python-chinese
Subject: [python-chinese] ÈçºÎʹÓÃftplib£¿

 

Hi ¸÷λ£º

 

ÇëÎÊÈçºÎʹÓÃFTPÀàµÄconnect·½·¨£¬ÊÔÁ˼¸´ÎÀÏÊDZ¨´í¡£

ÎÒÏëÁ¬½ÓµÄ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 Õ× £© <http://event.mail.163.com/chanel/click.htm?from=NO_25&domain;=163> 

-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080106/56ad88b3/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月07日 星期一 16:22

zhouzhenster在gmail.com zhouzhenster在gmail.com
星期一 一月 7 16:22:50 HKT 2008

´íÎóÐÅÏ¢£¿

¿´°ïÖú°¡¡£

[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 <fuyu0123456789在163.com> дµÀ£º
>
> Hi ¸÷λ£º
>
> ÇëÎÊÈçºÎʹÓÃFTPÀàµÄconnect·½·¨£¬ÊÔÁ˼¸´ÎÀÏÊDZ¨´í¡£
> ÎÒÏëÁ¬½ÓµÄ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 Õ× £©
> <http://event.mail.163.com/chanel/click.htm?from=NO_25&domain;=163>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
zhouzhen

http://www.6code.net
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080107/d9a758d6/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月07日 星期一 16:26

fuyu0123456789 fuyu0123456789在163.com
星期一 一月 7 16:26:23 HKT 2008

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

在2008-01-07,zhouzhenster在gmail.com 写道:
错误信息?

看帮助啊。

[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 <fuyu0123456789在163.com> 写道:
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 python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese




-- 
zhouzhen

http://www.6code.net
-------------- 涓嬩竴閮ㄥ垎 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20080107/3aa9aa20/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号