gpt4 book ai didi

python - 表示 unicode utf-8 或打印元素作为键盘输入的列表?

转载 作者:行者123 更新时间:2023-11-30 23:54:29 25 4
gpt4 key购买 nike

# -*- coding: utf-8 -*-
def present_unicode(list):
for a in list:
print u"%s" % a

尝试:

list1 = ['១','៤','០']#this list is what I input with the khmer keyboard.
print list1
>>> ['\xe1\x9f\xa1', '\xe1\x9f\xa4', '\xe1\x9f\xa0']

list2 = [u'\u17E2', u'\u17E4', u'\u17E0'] # <=>['\xe1\x9f\xa1', '\xe1\x9f\xa4', '\xe1\x9f\xa0']
print list2
>>>['\\u17E2', '\\u17E4', '\\u17E0']

输出:

if __name__ == "__main__":

present_unicode(list1) #output the same element as my input keyboard
present_unicode(list2)#output '\\u17E2', '\\u17E4', '\\u17E0' ???

我的问题是:使用 list2 如何显示我从键盘输入的内容?

最佳答案

关于python - 表示 unicode utf-8 或打印元素作为键盘输入的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5135970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com