溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

關(guān)于UTF字符碼

發(fā)布時(shí)間:2020-07-12 17:58:42 來源:網(wǎng)絡(luò) 閱讀:368 作者:磁盤陣列 欄目:開發(fā)技術(shù)

關(guān)于UTF字符碼


在ex9.py中,因?yàn)橥略趯W(xué)Espaol,于是裝了下,把星期和月份改成了Spanish。結(jié)果不顯示,然后開頭加了# -*- coding:utf-8 -*- 轉(zhuǎn)換,可以運(yùn)行顯示,但是 é都顯示了亂碼。改成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,對(duì)于拉丁字符,比如 é這類英語中沒有的怎么正常顯示呢?

或者加個(gè) %r 轉(zhuǎn)換行不行呢?

下次嘗試。












向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI