Unicode编码
将世界上的所有字符都编码,每个编码对应每一个字符
- chr() 将一个unicode编码转化为对应的字符
- ord() 将一个字符转化为unicode编码
for i in range(12):
print(str(chr(9800 + i)), end=' ')
十二星座图(9800为金牛座字符的编码)

print("1 + 1 = 2" + str(chr(10004)))

Unicode编码
将世界上的所有字符都编码,每个编码对应每一个字符
for i in range(12):
print(str(chr(9800 + i)), end=' ')
十二星座图(9800为金牛座字符的编码)
print("1 + 1 = 2" + str(chr(10004)))
本文标题:python 字符串有趣的两个方法
本文链接:https://www.haomeiwen.com/subject/odireqtx.html
网友评论