2007年06月22日 星期五 20:43
这种属于什么编码 '\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7' 这种又属于什么编码 u'\u5927\u5730\u65b9' 如何把第一种转换成第二种方法,或者把第二种转换成第一种? 谢谢。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20070622/00792799/attachment.html
2007年06月22日 星期五 21:03
'\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7' ÊÇ gbkÂë £¨¹«Ë¾µØÖ·£©
u'\u5927\u5730\u65b9' ÊÇ unicodeÂë¡£ £¨´óµØ·½£©
ת»»£º gbk µ½unicode
>>> x = '\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7'
>>> print x
¹«Ë¾ÍøÖ·
>>> x.decode('gbk')
u'\u516c\u53f8\u7f51\u5740'
>>> t = x.decode('gbk')
>>> print t
¹«Ë¾ÍøÖ·
unicode µ½gbk
>>> t = u'\u5927\u5730\u65b9'
>>> x = t.encode('gbk')
>>> print x
´óµØ·½
>>> x
'\xb4\xf3\xb5\xd8\xb7\xbd'
wang_zheng_yong
2007-06-22
·¢¼þÈË£º jason python.nbfan
·¢ËÍʱ¼ä£º 2007-06-22 20:43:48
ÊÕ¼þÈË£º python-chinese在lists.python.cn
³ËÍ£º
Ö÷Ì⣺ [python-chinese]Çë½Ì¹ØÓÚÖÐÎÄת»»
ÕâÖÖÊôÓÚʲô±àÂë
'\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7'
ÕâÖÖÓÖÊôÓÚʲô±àÂë
u'\u5927\u5730\u65b9'
ÈçºÎ°ÑµÚÒ»ÖÖת»»³ÉµÚ¶þÖÖ·½·¨£¬»òÕ߰ѵڶþÖÖת»»³ÉµÚÒ»ÖÖ?
лл¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070622/df22a083/attachment-0001.html
2007年06月22日 星期五 21:18
非常感谢,问题解决. 在07-6-22,wang_zheng_yong <wang_zheng_yong at 163.com> 写道: > > '\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7' 是 gbk码 (公司地址) > > > u'\u5927\u5730\u65b9' 是 unicode码。 (大地方) > > > 转换: gbk 到unicode > >>> x = '\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7' > >>> print x > 公司网址 > >>> x.decode('gbk') > u'\u516c\u53f8\u7f51\u5740' > >>> t = x.decode('gbk') > >>> print t > 公司网址 > > unicode 到gbk > >>> t = u'\u5927\u5730\u65b9' > >>> x = t.encode('gbk') > >>> print x > 大地方 > >>> x > '\xb4\xf3\xb5\xd8\xb7\xbd' > > > ------------------------------ > wang_zheng_yong > 2007-06-22 > ------------------------------ > *发件人:* jason python.nbfan > *发送时间:* 2007-06-22 20:43:48 > *收件人:* python-chinese at lists.python.cn > *抄送:* > *主题:* [python-chinese]请教关于中文转换 > > 这种属于什么编码 > '\xb9\xab\xcb\xbe\xcd\xf8\xd6\xb7' > > 这种又属于什么编码 > u'\u5927\u5730\u65b9' > > 如何把第一种转换成第二种方法,或者把第二种转换成第一种? > 谢谢。 > > _______________________________________________ > 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://python.cn/pipermail/python-chinese/attachments/20070622/852c099b/attachment.htm
Zeuux © 2025
京ICP备05028076号