Python论坛  - 讨论区

标题:Re: Re: [python-chinese]怎么得到httplib的异常呢?

2005年02月21日 星期一 14:21

hw_cg hw_cg at huawei.com
Mon Feb 21 14:21:29 HKT 2005

cry: 你好!

借鉴其他语言的异常思想,不是这样写捕获语句的.
你的捕获机制不完善,导致你漏掉了一些异常.

建议你的异常捕获象下面这样分级捕获, 每个异常捕获语句仅捕获自己感兴趣的异常,
最后使用Exception捕获所有未拦截的异常.

import httplib
import socket

try:
    conn = httplib.HTTPConnection("127.0.0.1:8080")
    conn.request("GET", "/")
    response = conn.getresponse()
    result = response.read()
    print result
    conn.close()

except socket.error, msg:
    print msg
    # do something other

except httplib.HTTPException,msg:
    print msg
    # do something other

except Exception, msg:
    print msg
    # do something other




----- Original Message ----- 
From: "cry" <zyqmail at 163.net>
To: "limodou, python-chinese at lists.python.cn" <limodou at gmail.com,python-chinese at lists.python.cn>
Sent: Monday, February 21, 2005 1:26 PM
Subject: Re: Re: [python-chinese] ÔõôµÃµ½httplib µÄÒì³£ÄØ£¿


limodou,您好!

直接用except:当然是没有问题,但是我需要错误信息呀,比如:
except error,msg:


在 2005-02-21 12:22:00 您写道:
>捕获Exception 不要httplib.HTTPException 试试
>
>
>On Mon, 21 Feb 2005 12:5:36 +0800, cry <zyqmail at 163.net> wrote:
>> python,您好!
>> 
>> 我做了如下的代码:
>> try:
>>         conn = httplib.HTTPConnection("192.168.1.103")
>>         conn.request("GET", "/")
>>         response = conn.getresponse()
>>         result = response.read()
>>         conn.close()
>>  except httplib.HTTPException , msg:
>>         print msg
>> 
>> 运行后:
>> Traceback (most recent call last):
>>   File "", line 3, in ?
>>   File "I:\Python23\lib\httplib.py", line 718, in request
>>     self._send_request(method, url, body, headers)
>>   File "I:\Python23\lib\httplib.py", line 739, in _send_request
>>     self.endheaders()
>>   File "I:\Python23\lib\httplib.py", line 712, in endheaders
>>     self._send_output()
>>   File "I:\Python23\lib\httplib.py", line 597, in _send_output
>>     self.send(msg)
>>   File "I:\Python23\lib\httplib.py", line 564, in send
>>     self.connect()
>>   File "I:\Python23\lib\httplib.py", line 532, in connect
>>     socket.SOCK_STREAM):
>> error: (10060, 'Operation timed out')
>> 
>> 错在那里呢?我怎么能控制httplib的exception呢?
>> 我这样处理ftplib就可以。
>> 
>> 谢谢。
>> 
>>>> 礼!
>> 
>>             cry
>>             zyqmail at 163.net
>> 
>> _______________________________________________
>> python-chinese list
>> python-chinese at lists.python.cn
>> http://python.cn/mailman/listinfo/python-chinese
>> 
>
>
>-- 
>I like python! 
>My Blog: http://www.donews.net/limodou
>New Maillist: http://groups-beta.google.com/group/python-cn
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese

                    致
礼!

            cry
            zyqmail at 163.net


_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese

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

2005年02月21日 星期一 14:45

limodou limodou at gmail.com
Mon Feb 21 14:45:40 HKT 2005

看来你没看清楚,我写得是

Exception 它是所有异常类的父类。它可以捕获所有异常。正如hw_cg所示例的那样


On Mon, 21 Feb 2005 14:21:29 +0800, hw_cg <hw_cg at huawei.com> wrote:
> cry: 你好!
> 
> 借鉴其他语言的异常思想,不是这样写捕获语句的.
> 你的捕获机制不完善,导致你漏掉了一些异常.
> 
> 建议你的异常捕获象下面这样分级捕获, 每个异常捕获语句仅捕获自己感兴趣的异常,
> 最后使用Exception捕获所有未拦截的异常.
> 
> import httplib
> import socket
> 
> try:
>     conn = httplib.HTTPConnection("127.0.0.1:8080")
>     conn.request("GET", "/")
>     response = conn.getresponse()
>     result = response.read()
>     print result
>     conn.close()
> 
> except socket.error, msg:
>     print msg
>     # do something other
> 
> except httplib.HTTPException,msg:
>     print msg
>     # do something other
> 
> except Exception, msg:
>     print msg
>     # do something other
> 
> ----- Original Message -----
> From: "cry" <zyqmail at 163.net>
> To: "limodou, python-chinese at lists.python.cn" <limodou at gmail.com,python-chinese at lists.python.cn>
> Sent: Monday, February 21, 2005 1:26 PM
> Subject: Re: Re: [python-chinese] ÔõôµÃµ½httplib µÄÒì³£ÄØ£¿
> 
> limodou,您好!
> 
> 直接用except:当然是没有问题,但是我需要错误信息呀,比如:
> except error,msg:
> 
> 在 2005-02-21 12:22:00 您写道:
> >捕获Exception 不要httplib.HTTPException 试试
> >
> >
> >On Mon, 21 Feb 2005 12:5:36 +0800, cry <zyqmail at 163.net> wrote:
> >> python,您好!
> >>
> >> 我做了如下的代码:
> >> try:
> >>         conn = httplib.HTTPConnection("192.168.1.103")
> >>         conn.request("GET", "/")
> >>         response = conn.getresponse()
> >>         result = response.read()
> >>         conn.close()
> >>  except httplib.HTTPException , msg:
> >>         print msg
> >>
> >> 运行后:
> >> Traceback (most recent call last):
> >>   File "", line 3, in ?
> >>   File "I:\Python23\lib\httplib.py", line 718, in request
> >>     self._send_request(method, url, body, headers)
> >>   File "I:\Python23\lib\httplib.py", line 739, in _send_request
> >>     self.endheaders()
> >>   File "I:\Python23\lib\httplib.py", line 712, in endheaders
> >>     self._send_output()
> >>   File "I:\Python23\lib\httplib.py", line 597, in _send_output
> >>     self.send(msg)
> >>   File "I:\Python23\lib\httplib.py", line 564, in send
> >>     self.connect()
> >>   File "I:\Python23\lib\httplib.py", line 532, in connect
> >>     socket.SOCK_STREAM):
> >> error: (10060, 'Operation timed out')
> >>
> >> 错在那里呢?我怎么能控制httplib的exception呢?
> >> 我这样处理ftplib就可以。
> >>
> >> 谢谢。
> >>
> >>                     致
> >> 礼!
> >>
> >>             cry
> >>             zyqmail at 163.net
> >>
> >> _______________________________________________
> >> python-chinese list
> >> python-chinese at lists.python.cn
> >> http://python.cn/mailman/listinfo/python-chinese
> >>
> >
> >
> >--
> >I like python!
> >My Blog: http://www.donews.net/limodou
> >New Maillist: http://groups-beta.google.com/group/python-cn
> >_______________________________________________
> >python-chinese list
> >python-chinese at lists.python.cn
> >http://python.cn/mailman/listinfo/python-chinese
> 
>> 礼!
> 
>             cry
>             zyqmail at 163.net
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
I like python! 
My Blog: http://www.donews.net/limodou
New Maillist: http://groups-beta.google.com/group/python-cn


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

2005年02月21日 星期一 15:16

hw_cg hw_cg at huawei.com
Mon Feb 21 15:16:53 HKT 2005

是的, 如果没有兴趣去处理特定异常,就用 Exception 捕获所有异常即可.

----------------------------------------------------------------------------------------------------------------
另外,对limodou 大侠有个不情之请:
鉴于最近很多人都问起关于 Python 处理各种编码方面的问题,例如中文化显示,编码转化等等.
占了整个帖子数量的10%左右.看来这是一个大家都会遇到的问题.

limodou 大侠能否就这方面的内容做一个专题, 写一篇文章, 一劳永逸的解决这类问题.
否则,这样零零散散的回答,不仅很耽误您的时间,我猜想对他人的帮助效果也不好.

----------------------------------------------------------------------------------------------------------------




----- Original Message ----- 
From: "limodou" <limodou at gmail.com>
To: <python-chinese at lists.python.cn>
Sent: Monday, February 21, 2005 2:45 PM
Subject: Re: Re: [python-chinese]怎么得到http lib的异常呢?


看来你没看清楚,我写得是

Exception 它是所有异常类的父类。它可以捕获所有异常。正如hw_cg所示例的那样


On Mon, 21 Feb 2005 14:21:29 +0800, hw_cg <hw_cg at huawei.com> wrote:
> cry: 你好!
> 
> 借鉴其他语言的异常思想,不是这样写捕获语句的.
> 你的捕获机制不完善,导致你漏掉了一些异常.
> 
> 建议你的异常捕获象下面这样分级捕获, 每个异常捕获语句仅捕获自己感兴趣的异常,
> 最后使用Exception捕获所有未拦截的异常.
> 
> import httplib
> import socket
> 
> try:
>     conn = httplib.HTTPConnection("127.0.0.1:8080")
>     conn.request("GET", "/")
>     response = conn.getresponse()
>     result = response.read()
>     print result
>     conn.close()
> 
> except socket.error, msg:
>     print msg
>     # do something other
> 
> except httplib.HTTPException,msg:
>     print msg
>     # do something other
> 
> except Exception, msg:
>     print msg
>     # do something other
> 
> ----- Original Message -----
> From: "cry" <zyqmail at 163.net>
> To: "limodou, python-chinese at lists.python.cn" <limodou at gmail.com,python-chinese at lists.python.cn>
> Sent: Monday, February 21, 2005 1:26 PM
> Subject: Re: Re: [python-chinese] ÔõôµÃµ½httplib µÄÒì³£ÄØ£¿
> 
> limodou,您好!
> 
> 直接用except:当然是没有问题,但是我需要错误信息呀,比如:
> except error,msg:
> 
> 在 2005-02-21 12:22:00 您写道:
> >捕获Exception 不要httplib.HTTPException 试试
> >
> >
> >On Mon, 21 Feb 2005 12:5:36 +0800, cry <zyqmail at 163.net> wrote:
> >> python,您好!
> >>
> >> 我做了如下的代码:
> >> try:
> >>         conn = httplib.HTTPConnection("192.168.1.103")
> >>         conn.request("GET", "/")
> >>         response = conn.getresponse()
> >>         result = response.read()
> >>         conn.close()
> >>  except httplib.HTTPException , msg:
> >>         print msg
> >>
> >> 运行后:
> >> Traceback (most recent call last):
> >>   File "", line 3, in ?
> >>   File "I:\Python23\lib\httplib.py", line 718, in request
> >>     self._send_request(method, url, body, headers)
> >>   File "I:\Python23\lib\httplib.py", line 739, in _send_request
> >>     self.endheaders()
> >>   File "I:\Python23\lib\httplib.py", line 712, in endheaders
> >>     self._send_output()
> >>   File "I:\Python23\lib\httplib.py", line 597, in _send_output
> >>     self.send(msg)
> >>   File "I:\Python23\lib\httplib.py", line 564, in send
> >>     self.connect()
> >>   File "I:\Python23\lib\httplib.py", line 532, in connect
> >>     socket.SOCK_STREAM):
> >> error: (10060, 'Operation timed out')
> >>
> >> 错在那里呢?我怎么能控制httplib的exception呢?
> >> 我这样处理ftplib就可以。
> >>
> >> 谢谢。
> >>
> >>                     致
> >> 礼!
> >>
> >>             cry
> >>             zyqmail at 163.net
> >>
> >> _______________________________________________
> >> python-chinese list
> >> python-chinese at lists.python.cn
> >> http://python.cn/mailman/listinfo/python-chinese
> >>
> >
> >
> >--
> >I like python!
> >My Blog: http://www.donews.net/limodou
> >New Maillist: http://groups-beta.google.com/group/python-cn
> >_______________________________________________
> >python-chinese list
> >python-chinese at lists.python.cn
> >http://python.cn/mailman/listinfo/python-chinese
> 
>> 礼!
> 
>             cry
>             zyqmail at 163.net
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
I like python! 
My Blog: http://www.donews.net/limodou
New Maillist: http://groups-beta.google.com/group/python-cn
_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese

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

2005年02月21日 星期一 15:42

Zoom Quiet zoom.quiet at gmail.com
Mon Feb 21 15:42:48 HKT 2005

很早就在啄木鸟中进行了收集的!只是大家不习惯使用 Wiki 才被忽略的吧??

http://wiki.woodpecker.org.cn/moin.cgi/PythonInChinese

嗬嗬!!!


On Mon, 21 Feb 2005 15:16:53 +0800, hw_cg <hw_cg at huawei.com> wrote:
> 是的, 如果没有兴趣去处理特定异常,就用 Exception 捕获所有异常即可.
> 
> ----------------------------------------------------------------------------------------------------------------
> 另外,对limodou 大侠有个不情之请:
> 鉴于最近很多人都问起关于 Python 处理各种编码方面的问题,例如中文化显示,编码转化等等.
> 占了整个帖子数量的10%左右.看来这是一个大家都会遇到的问题.
> 
> limodou 大侠能否就这方面的内容做一个专题, 写一篇文章, 一劳永逸的解决这类问题.
> 否则,这样零零散散的回答,不仅很耽误您的时间,我猜想对他人的帮助效果也不好.
> 
> ----------------------------------------------------------------------------------------------------------------
> 

-- 
[Time is unimportant, only life important!]

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

2005年02月21日 星期一 15:47

hw_cg hw_cg at huawei.com
Mon Feb 21 15:47:23 HKT 2005

Zoom Quiet
   你好!
 
 我这里现在不能使用浏览器上网,能否把这篇文章发给我一份呢. 多谢!




----- Original Message ----- 
From: "Zoom Quiet" <zoom.quiet at gmail.com>
To: <python-chinese at lists.python.cn>
Sent: Monday, February 21, 2005 3:42 PM
Subject: [python-chinese] Re: 对limodou 大侠有个不情之请////Re: Re: [ python-chinese]怎么得到http lib的异常呢?


> 很早就在啄木鸟中进行了收集的!只是大家不习惯使用 Wiki 才被忽略的吧??
> 
> http://wiki.woodpecker.org.cn/moin.cgi/PythonInChinese
> 
> 嗬嗬!!!
> 
> 
> On Mon, 21 Feb 2005 15:16:53 +0800, hw_cg <hw_cg at huawei.com> wrote:
> > 是的, 如果没有兴趣去处理特定异常,就用 Exception 捕获所有异常即可.
> > 
> > ----------------------------------------------------------------------------------------------------------------
> > 另外,对limodou 大侠有个不情之请:
> > 鉴于最近很多人都问起关于 Python 处理各种编码方面的问题,例如中文化显示,编码转化等等.
> > 占了整个帖子数量的10%左右.看来这是一个大家都会遇到的问题.
> > 
> > limodou 大侠能否就这方面的内容做一个专题, 写一篇文章, 一劳永逸的解决这类问题.
> > 否则,这样零零散散的回答,不仅很耽误您的时间,我猜想对他人的帮助效果也不好.
> > 
> > ----------------------------------------------------------------------------------------------------------------
> > 
> 
> -- 
> [Time is unimportant, only life important!]
> 


--------------------------------------------------------------------------------


> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 

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

2005年02月21日 星期一 15:54

Zoom Quiet zoom.quiet at gmail.com
Mon Feb 21 15:54:28 HKT 2005

呀呀呀?这样的哪??
看来 WeKonw 一定要全面支持 mail 的能力!!

直接贴 Wiki 原文了
++++++++++++++++++++++
##language:zh
'''
整理一下子,我们可以收集到的 Python 中文处理技巧!
'''
 * ''大家一起来总结,争取形成一个中文Python 开发常用库出来?!''

-- Zoom.Quiet [[[DateTime(2004-08-12T21:21:57Z)]]]
[[TableOfContents]]


= 原则 =
 * [http://nocache.czug.org/blog/panjunyong/python-encoding
Python的编码处理技术] -- CZUG的整理
''统一到unicode上来吧!''
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=495520&page;=&view;=&sb;=&o;=&vc;=1
在Python中使用中文]
 * [http://www.linuxforum.net/forum/showthreaded.php?Cat=&Board;=python&Number;=495807&Search;=true&Forum;=python&Words;=gb&Match;=Entire%20Phrase&Searchpage;=0&Limit;=25&Old;=allposts&Main;=495520
关于何时需要码制转换的一些考虑]
=== Web的中文处理 ===
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=352059&page;=&view;=&sb;=&o;=&vc;=1
页面的编码选择]
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=444261&page;=&view;=&sb;=&o;=&vc;=1
CGI的Py中文处理]

== 中文的支持 ==
 * [http://cjkpython.i18n.org/ cjkpython]-- 标准的亚洲支持编辑 Python版本
 * 如何让Python 支持GB?
   * [http://www.donews.net/limodou/archive/2004/03/30/9429.aspx
如何让python支持gb2312解码]
   * [http://pyrecord.freezope.org/download/gb2312.zip/down GB2312解码文件]
 * 如何让Python 支持Big5?
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=284910&page;=3&view;=collapsed&sb;=5&o;=all&fpart;=
生成GB2312字符集的内码表]
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=387330&page;=2&view;=collapsed&sb;=5&o;=all&fpart;=
实现Plone的GB2312编码]
== GB与Big5 ==
 * 如何在Python中进行 GB到Big5的转换?
  * (代码)[http://pyrecord.freezope.org/download/pygb2big.zip/down GB与Big5码互换]
 * 如何在Python中进行 Big5到GB的转换?

== GB与unicode ==
 * 如何在Python中进行 GB到unicode的转换?
   * python [http://www.linuxforum.net/forum/showthreaded.php?Cat=&Board;=python&Number;=427317&page;=&view;=&sb;=&o;=
中文解决方法] gb2312 <==> utf8
 * 如何在Python中进行 unicode到GB的转换?
 * 个人建议 --GreyRoar:
    * 1。如非必要,尽量避免转换,直接使用Unicode就可以;
    * 2。尽量不要来回转换;
    * 3。不要假设Unicode是超集。

== UTF-8 ==
 * [http://www.cl.cam.ac.uk/~mgk25/unicode.html
什么是unicode?什么是UTF-8?UTF-16?] -- FAQ for xUnix
 * [http://www.donews.net/limodou/archive/2004/04/13/12002.aspx UTF-8编码的文件检测函数]
 * 检测函数升级! [http://www.donews.net/limodou/archive/2004/09/23/107404.aspx
NewEdit-The change of UTF-8 detecting]
 * attachment:encdet.py Google 列表中提到的处理脚本
== 中文处理代码片段 ==
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=427317&page;=0&view;=collapsed&sb;=5&o;=all&fpart;=
python 中文解决方法 gb2312 <==> utf8 - China Linux Forum]

= 内核支持! =
 * [http://www.chinesepython.org/cgi_bin/cgb.cgi/home.html 中蟒]



On Mon, 21 Feb 2005 15:47:23 +0800, hw_cg <hw_cg at huawei.com> wrote:
> Zoom Quiet
>    你好!
> 
> 我这里现在不能使用浏览器上网,能否把这篇文章发给我一份呢.多谢!
> 
> ----- Original Message -----
> From: "Zoom Quiet" <zoom.quiet at gmail.com>
> To: <python-chinese at lists.python.cn>
> Sent: Monday, February 21, 2005 3:42 PM
> Subject: [python-chinese] Re: 对limodou 大侠有个不情之请////Re: Re: [ python-chinese]怎么得到http lib的异常呢?
> 
> > 很早就在啄木鸟中进行了收集的!只是大家不习惯使用 Wiki 才被忽略的吧??
> >
> > http://wiki.woodpecker.org.cn/moin.cgi/PythonInChinese
> >
> > 嗬嗬!!!
> >
> >
> > On Mon, 21 Feb 2005 15:16:53 +0800, hw_cg <hw_cg at huawei.com> wrote:
> > > 是的, 如果没有兴趣去处理特定异常,就用 Exception 捕获所有异常即可.
> > >
> > > ----------------------------------------------------------------------------------------------------------------
> > > 另外,对limodou 大侠有个不情之请:
> > > 鉴于最近很多人都问起关于 Python 处理各种编码方面的问题,例如中文化显示,编码转化等等.
> > > 占了整个帖子数量的10%左右.看来这是一个大家都会遇到的问题.
> > >
> > > limodou 大侠能否就这方面的内容做一个专题, 写一篇文章, 一劳永逸的解决这类问题.
> > > 否则,这样零零散散的回答,不仅很耽误您的时间,我猜想对他人的帮助效果也不好.
> > >
> > > ----------------------------------------------------------------------------------------------------------------
> > >
> >
> > --
> > [Time is unimportant, only life important!]
> >
> 
> --------------------------------------------------------------------------------
> 
> > _______________________________________________
> > python-chinese list
> > python-chinese at lists.python.cn
> > http://python.cn/mailman/listinfo/python-chinese
> > 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
[Time is unimportant, only life important!]


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

2005年02月21日 星期一 16:04

hw_cg hw_cg at huawei.com
Mon Feb 21 16:04:04 HKT 2005

这些只是一些链接啊,我还得上网才能看.呵呵,挺多的,不麻烦你了,我晚上回家以后就可以上网看了.


我倒是觉得WeKnow一定要支持沿特定信息链的打包保存能力哦. :)
即,我选中一个信息项后,进行保存,它能把本信息项页面中链接的子项的信息也一并打包保存,而不是仅仅保存当前一个页的信息,因为我选中的这个信息项页往往有可能仅仅是一个目录或者列表呢.


----- Original Message ----- 
From: "Zoom Quiet" <zoom.quiet at gmail.com>
To: <python-chinese at lists.python.cn>
Sent: Monday, February 21, 2005 3:54 PM
Subject: Re: [python-chinese] ////Re: Re: [ python-chinese] 怎么得到http lib的异常呢?


呀呀呀?这样的哪??
看来 WeKonw 一定要全面支持 mail 的能力!!

直接贴 Wiki 原文了
++++++++++++++++++++++
##language:zh
'''
整理一下子,我们可以收集到的 Python 中文处理技巧!
'''
 * ''大家一起来总结,争取形成一个中文Python 开发常用库出来?!''

-- Zoom.Quiet [[[DateTime(2004-08-12T21:21:57Z)]]]
[[TableOfContents]]


= 原则 =
 * [http://nocache.czug.org/blog/panjunyong/python-encoding
Python的编码处理技术] -- CZUG的整理
''统一到unicode上来吧!''
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=495520&page;=&view;=&sb;=&o;=&vc;=1
在Python中使用中文]
 * [http://www.linuxforum.net/forum/showthreaded.php?Cat=&Board;=python&Number;=495807&Search;=true&Forum;=python&Words;=gb&Match;=Entire%20Phrase&Searchpage;=0&Limit;=25&Old;=allposts&Main;=495520
关于何时需要码制转换的一些考虑]
=== Web的中文处理 ===
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=352059&page;=&view;=&sb;=&o;=&vc;=1
页面的编码选择]
 * [http://www.linuxforum.net/forum/showflat.php?Cat=&Board;=python&Number;=444261&page;=&view;=&sb;=&o;=&vc;=1
CGI的Py中文处理]

== 中文的支持 ==
 * [http://cjkpython.i18n.org/ cjkpython]-- 标准的亚洲支持编辑 Python版本
 * 如何让Python 支持GB?
   * [http://www.donews.net/limodou/archive/2004/03/30/9429.aspx
如何让python支持gb2312解码]
   * [http://pyrecord.freezope.org/download/gb2312.zip/down GB2312解码文件]
 * 如何让Python 支持Big5?
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=284910&page;=3&view;=collapsed&sb;=5&o;=all&fpart;=
生成GB2312字符集的内码表]
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=387330&page;=2&view;=collapsed&sb;=5&o;=all&fpart;=
实现Plone的GB2312编码]
== GB与Big5 ==
 * 如何在Python中进行 GB到Big5的转换?
  * (代码)[http://pyrecord.freezope.org/download/pygb2big.zip/down GB与Big5码互换]
 * 如何在Python中进行 Big5到GB的转换?

== GB与unicode ==
 * 如何在Python中进行 GB到unicode的转换?
   * python [http://www.linuxforum.net/forum/showthreaded.php?Cat=&Board;=python&Number;=427317&page;=&view;=&sb;=&o;=
中文解决方法] gb2312 <==> utf8
 * 如何在Python中进行 unicode到GB的转换?
 * 个人建议 --GreyRoar:
    * 1。如非必要,尽量避免转换,直接使用Unicode就可以;
    * 2。尽量不要来回转换;
    * 3。不要假设Unicode是超集。

== UTF-8 ==
 * [http://www.cl.cam.ac.uk/~mgk25/unicode.html
什么是unicode?什么是UTF-8?UTF-16?] -- FAQ for xUnix
 * [http://www.donews.net/limodou/archive/2004/04/13/12002.aspx UTF-8编码的文件检测函数]
 * 检测函数升级! [http://www.donews.net/limodou/archive/2004/09/23/107404.aspx
NewEdit-The change of UTF-8 detecting]
 * attachment:encdet.py Google 列表中提到的处理脚本
== 中文处理代码片段 ==
 * [http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=427317&page;=0&view;=collapsed&sb;=5&o;=all&fpart;=
python 中文解决方法 gb2312 <==> utf8 - China Linux Forum]

= 内核支持! =
 * [http://www.chinesepython.org/cgi_bin/cgb.cgi/home.html 中蟒]



On Mon, 21 Feb 2005 15:47:23 +0800, hw_cg <hw_cg at huawei.com> wrote:
> Zoom Quiet
>    你好!
> 
> 我这里现在不能使用浏览器上网,能否把这篇文章发给我一份呢.多谢!
> 
> ----- Original Message -----
> From: "Zoom Quiet" <zoom.quiet at gmail.com>
> To: <python-chinese at lists.python.cn>
> Sent: Monday, February 21, 2005 3:42 PM
> Subject: [python-chinese] Re: 对limodou 大侠有个不情之请////Re: Re: [ python-chinese]怎么得到http lib的异常呢?
> 
> > 很早就在啄木鸟中进行了收集的!只是大家不习惯使用 Wiki 才被忽略的吧??
> >
> > http://wiki.woodpecker.org.cn/moin.cgi/PythonInChinese
> >
> > 嗬嗬!!!
> >
> >
> > On Mon, 21 Feb 2005 15:16:53 +0800, hw_cg <hw_cg at huawei.com> wrote:
> > > 是的, 如果没有兴趣去处理特定异常,就用 Exception 捕获所有异常即可.
> > >
> > > ----------------------------------------------------------------------------------------------------------------
> > > 另外,对limodou 大侠有个不情之请:
> > > 鉴于最近很多人都问起关于 Python 处理各种编码方面的问题,例如中文化显示,编码转化等等.
> > > 占了整个帖子数量的10%左右.看来这是一个大家都会遇到的问题.
> > >
> > > limodou 大侠能否就这方面的内容做一个专题, 写一篇文章, 一劳永逸的解决这类问题.
> > > 否则,这样零零散散的回答,不仅很耽误您的时间,我猜想对他人的帮助效果也不好.
> > >
> > > ----------------------------------------------------------------------------------------------------------------
> > >
> >
> > --
> > [Time is unimportant, only life important!]
> >
> 
> --------------------------------------------------------------------------------
> 
> > _______________________________________________
> > python-chinese list
> > python-chinese at lists.python.cn
> > http://python.cn/mailman/listinfo/python-chinese
> > 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 


-- 
[Time is unimportant, only life important!]
_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号