且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用中文在Python中建立字典

更新时间:2023-09-13 23:34:58

在打印字典时(例如, print(dictionary)),键的 repr 并显示值.

When printing a dict, (e.g. print(dictionary)), the reprs of the keys and values are displayed.

相反,请尝试:

dictionary = {u"Hello" : u"你好"} 
for key,value in dictionary.iteritems():
    print(u'{k} --> {v}'.format(k=key,v=value))

产量:

Hello --> 你好