Python 中有 3 个不可思议的返回功能
作者:互联网
今天给大家分享 3 个比较冷门的知识
第一个:神奇的字典键
some_dict = {}
some_dict[5.5] = "Ruby"
some_dict[5.0] = "JavaScript"
some_dict[5] = "Python"
Output:
>>> some_dict[5.5]
"Ruby"
>>> some_dict[5.0]
"Python"
>>> some_dict[5]
"Python"
"Python" 消除了 "JavaScript" 的存在?
标签:返回,不可思议,Python,some,对象,dict,WTF,id 来源: https://blog.csdn.net/m0_62051288/article/details/122072502