Python论坛  - 讨论区

标题:[python-chinese] python的编码问题

2005年12月16日 星期五 08:50

zhang sw.zhangxy swzhangxy at gmail.com
Fri Dec 16 08:50:33 HKT 2005

我要解析 xml中有汉字,在xml中 encoding="",
在python中, # -*- coding: -*-   又应该是什么,那位好好给解释一下,关于编码迷茫阿!


--
今天决定明天!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051216/a2c5be1e/attachment.htm

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

2005年12月16日 星期五 08:54

limodou limodou at gmail.com
Fri Dec 16 08:54:35 HKT 2005

在 05-12-16,zhang sw.zhangxy<swzhangxy at gmail.com> 写道:
> 我要解析 xml中有汉字,在xml中 encoding="",
> 在python中, # -*- coding: -*-   又应该是什么,那位好好给解释一下,关于编码迷茫阿!
>

请不要发相同的邮件,这个邮件不是已经回过了嘛!

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

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

2005年12月19日 星期一 09:22

EricJonah ericjonah at gmail.com
Mon Dec 19 09:22:14 HKT 2005

#! -*- encoding:utf-8 *-
是指定文件编码方式

import locale
def utf8(str,encoding=locale.getdefaultlocale()[1]):
        tmp = unicode(str,"utf-8")
        return tmp.encode(encoding)

在 05-12-16,limodou<limodou at gmail.com> 写道:
> 在 05-12-16,zhang sw.zhangxy<swzhangxy at gmail.com> 写道:
> > 我要解析 xml中有汉字,在xml中 encoding="",
> > 在python中, # -*- coding: -*-   又应该是什么,那位好好给解释一下,关于编码迷茫阿!
> >
>
> 请不要发相同的邮件,这个邮件不是已经回过了嘛!
>
> --
> 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
>
>

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

2005年12月22日 星期四 12:29

hit.zealous at gmail.com hit.zealous at gmail.com
Thu Dec 22 12:29:03 HKT 2005

测试!~

一直在关注Python,不过在潜水,最近受不到Phthon列表了。。。

怎么回事??


在05-12-16,zhang sw.zhangxy <swzhangxy at gmail.com> 写道:
>
> 我要解析 xml中有汉字,在xml中 encoding="",
> 在python中, # -*- coding: -*-   又应该是什么,那位好好给解释一下,关于编码迷茫阿!
>
>
> --
> 今天决定明天!
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051222/e47d23ad/attachment.html

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

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

    你的回复:

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

    Zeuux © 2025

    京ICP备05028076号