2006年03月14日 星期二 20:39
在Dive Into Python 中9.2Unicode 提到了这个方法 1)sys.getdefaultencoding() 2)sys.setdefaultencoding('iso-8859-1') 第一个方法好用 执行第二个 >>> import sys >>> sys.setdefaultencoding('iso-8859-1') Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'setdefaultencoding' >>> 但python文档中sys有setdefaultencoding()方法? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060314/e76387ec/attachment.htm
2006年03月14日 星期二 21:35
On 3/14/06, wu wunc <superwunc at gmail.com> wrote: > 在Dive Into Python 中9.2Unicode > 提到了这个方法 > 1)sys.getdefaultencoding() > 2)sys.setdefaultencoding('iso-8859-1') > 第一个方法好用 > 执行第二个 > >>> import sys > >>> sys.setdefaultencoding('iso-8859-1') > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'module' object has no attribute 'setdefaultencoding' > >>> > 但python文档中sys有setdefaultencoding()方法? > python在启动时会自动执行site.py这个程序,然后会自动将sys.setdefaultencoding这个方法删除。因此你可以通过reload(sys),然后就可以使用了。 -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年03月15日 星期三 09:36
in my cases(all unicode operations),I haven't seen the need of using setdefaultencoding. but if there were use cases one must use setdefaultencoding, I 'd like to know. ----- Original Message ----- From: "limodou" <limodou at gmail.com> To: <python-chinese at lists.python.cn> Sent: Tuesday, March 14, 2006 9:35 PM Subject: Re: [python-chinese] sys设置系统缺省编码的问题 > On 3/14/06, wu wunc <superwunc at gmail.com> wrote: >> 在Dive Into Python 中9.2Unicode >> 提到了这个方法 >> 1)sys.getdefaultencoding() >> 2)sys.setdefaultencoding('iso-8859-1') >> 第一个方法好用 >> 执行第二个 >> >>> import sys >> >>> sys.setdefaultencoding('iso-8859-1') >> Traceback (most recent call last): >> File "", line 1, in ? >> AttributeError: 'module' object has no attribute 'setdefaultencoding' >> >>> >> 但python文档中sys有setdefaultencoding()方法? >> > > python在启动时会自动执行site.py这个程序,然后会自动将sys.setdefaultencoding这个方法删除。因此你可以通过reload(sys),然后就可以使用了。 > > -- > I like python! > My Blog: http://www.donews.net/limodou > NewEdit Maillist: http://groups.google.com/group/NewEdit > -------------------------------------------------------------------------------- > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年03月15日 星期三 16:36
在06-3-15,Slowness Chen <chenzh at bhh.com.cn> 写道: > in my cases(all unicode operations),I haven't seen the need of using > setdefaultencoding. > but if there were use cases one must use setdefaultencoding, I 'd like to > know. 这个我也想知道 -- 云电清华同方小民工 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060315/07b96e60/attachment.html
2006年03月15日 星期三 17:27
On 3/15/06, 笨笨狗 <chen.ruijie at gmail.com> wrote: > 在06-3-15,Slowness Chen <chenzh at bhh.com.cn> 写道: > > in my cases(all unicode operations),I haven't seen the need of using > > setdefaultencoding. > > but if there were use cases one must use setdefaultencoding, I 'd like to > > know. > > > 这个我也想知道 > 在我以前写的 confbot 程序中就用到了这一技巧,不过我忘了为什么这样用了。 -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年03月15日 星期三 17:42
建立一个文件 sitecustomize.py 放在你的 site-package里面 然后 import 就可以了 ---------------------------- #!/usr/bin/python # -*- coding: utf-8 -*- # Create Time : 2006-2-20 20:42:50 import sys sys.setdefaultencoding('utf-8') # 'utf-8' 是你需要的编码 -------------------------------------- On 3/15/06, limodou <limodou at gmail.com> wrote: > On 3/15/06, 笨笨狗 <chen.ruijie at gmail.com> wrote: > > 在06-3-15,Slowness Chen <chenzh at bhh.com.cn> 写道: > > > in my cases(all unicode operations),I haven't seen the need of using > > > setdefaultencoding. > > > but if there were use cases one must use setdefaultencoding, I 'd like to > > > know. > > > > > > 这个我也想知道 > > > > 在我以前写的 confbot 程序中就用到了这一技巧,不过我忘了为什么这样用了。 > > > -- > I like python! > My Blog: http://www.donews.net/limodou > NewEdit Maillist: http://groups.google.com/group/NewEdit > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > >
2006年03月16日 星期四 01:43
http://www.cheetahtemplate.org/whouses.html ----- Original Message ----- From: "limodou" <limodou at gmail.com> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 15, 2006 5:27 PM Subject: Re: [python-chinese] sys设置系统缺省编码的问题 > On 3/15/06, 笨笨狗 <chen.ruijie at gmail.com> wrote: >> 在06-3-15,Slowness Chen <chenzh at bhh.com.cn> 写道: >> > in my cases(all unicode operations),I haven't seen the need of using >> > setdefaultencoding. >> > but if there were use cases one must use setdefaultencoding, I 'd like to >> > know. >> >> >> 这个我也想知道 >> > > 在我以前写的 confbot 程序中就用到了这一技巧,不过我忘了为什么这样用了。 > > > -- > I like python! > My Blog: http://www.donews.net/limodou > NewEdit Maillist: http://groups.google.com/group/NewEdit > -------------------------------------------------------------------------------- > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年03月16日 星期四 09:37
-1, that may break third-party libraries and your program's portability ----- Original Message ----- From: "fla liu" <fla.liu at gmail.com> To: <python-chinese at lists.python.cn> Sent: Wednesday, March 15, 2006 5:42 PM Subject: Re: [python-chinese] sys设置系统缺省编码的问题 > 建立一个文件 sitecustomize.py 放在你的 site-package里面 > 然后 import 就可以了 > ---------------------------- > #!/usr/bin/python > # -*- coding: utf-8 -*- > # Create Time : 2006-2-20 20:42:50 > > import sys > sys.setdefaultencoding('utf-8') > # 'utf-8' 是你需要的编码 > -------------------------------------- > > On 3/15/06, limodou <limodou at gmail.com> wrote: >> On 3/15/06, 笨笨狗 <chen.ruijie at gmail.com> wrote: >> > 在06-3-15,Slowness Chen <chenzh at bhh.com.cn> 写道: >> > > in my cases(all unicode operations),I haven't seen the need of using >> > > setdefaultencoding. >> > > but if there were use cases one must use setdefaultencoding, I 'd >> > > like to >> > > know. >> > >> > >> > 这个我也想知道 >> > >> >> 在我以前写的 confbot 程序中就用到了这一技巧,不过我忘了为什么这样用了。 >> >> >> -- >> I like python! >> My Blog: http://www.donews.net/limodou >> NewEdit Maillist: http://groups.google.com/group/NewEdit >> >> _______________________________________________ >> python-chinese >> Post: send python-chinese at lists.python.cn >> Subscribe: send subscribe to python-chinese-request at lists.python.cn >> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn >> Detail Info: http://python.cn/mailman/listinfo/python-chinese >> >> > -------------------------------------------------------------------------------- > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
Zeuux © 2025
京ICP备05028076号