林岑庭PYTHON的ord與chr等於unicode與unichar

 a="一" #python可以使用單或雙表示字元

print(a,"的字碼",ord(a))

for i in range(19968,20000):

print(i,"字元",chr(I))

<PRE STYLE="BORDER: SOLID PINK 6PX;FONT-SIZE:1.2EM">

#python常用的內建函數print, type, ord字碼, chr字元,chr代表character
one = "一"
print(one,'的型態',type(one))
print(one, "的字碼", ord(one))
for i in range(19968,20000):
   print(i,'的字元',chr(i))
</PRE>

一 19968 的字碼
19968 一
19969 丁
19970 丂
19971 七
19972 丄
19973 丅
19974 丆
19975 万
19976 丈


留言

  1. 921,google「林岑庭python」找到網頁!很傑出!
    908,必須在HTML模式下貼上,PRE STYLE="BORDER: SOLID PINK 6PX;FONT-SIZE:1.2EM"才會發揮作用。https://lin-cen-ting.blogspot.com/2026/09/pythonordchrunicodeunichar.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

林岑庭python集合set字典dict統計字元數目37,241不同字元數1,251

林岑庭EXCEL公式Formulas

林岑庭EXCEL函數MATCH,INDEX,ISNUMBER