关于UTF字符码
在ex9.py中,因为同事在学Espaol,于是装了下,把星期和月份改成了Spanish。结果不显示,然后开头加了# -*- coding:utf-8 -*- 转换,可以运行显示,但是 é都显示了乱码。改成utf-16或者32都不行。
代码:
# -*- coding:utf-8 -*-
#here's some new strange stuff, remember type it exactly.
days = "lunes martes miércoles jueves viernes sábado domingo"
months = "\nenero\nfebrero\nmarzo\nabril\nmayo\njunio\njulio\nagosto\nseptiembre\noctubre\nnoviembre\ndiciembre"
print "Here are the days: ", days
print "Here are the months: ", months
print """
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want,or 5, or 6.
"""
SO,对于拉丁字符,比如 é这类英语中没有的怎么正常显示呢?
或者加个 %r 转换行不行呢?
下次尝试。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。