Open yellow diamond python Chinese characters sorted by pinyin from xpinyin import Pinyinlist_word =["Samsung","Xiaomi","Apple","Huawei"]py = Pinyin()temp =[]for i in list_word: temp.append((py .

2024/05/1810:56:33 technology 1016

Open Yellow Diamond

Open yellow diamond python Chinese characters sorted by pinyin from xpinyin import Pinyinlist_word =[

pythonChinese characters are sorted by pinyin

from xpinyin import Pinyin

list_word =["Samsung","Xiaomi" ,"Apple ","Huawei "]
py = Pinyin ()
temp =[]
for i in list_word:
temp.append((py.get_pinyin(i),i))
temp.sort()
print(temp)

:[('hua-wei', 'Huawei') , ('ping-guo', 'Apple'), ('san-xing', 'Samsung'), ('xiao-mi', '小米')]

technology Category Latest News