易百教程

23、如何在 Python 中创建 Unicode 字符串?

在 Python 3 中,旧的 Unicode 类型已经替换为“str”类型,字符串默认被视为 Unicode。 我们可以使用 art.title.encode("utf-8") 函数在 Unicode 中创建一个字符串。

例子:

unicode_1 = ("\u0123", "\u2665", "\U0001f638", "\u265E", "\u265F", "\u2168")  
print (unicode_1)

运行结果: