摘要:问题: 如何查找在两个字典中相同的键、值元素? dict1 = {'a': 1, 'b': 2, 'c': 3} dict2 = {'a': 10, 'y': 11,'b': 2} dict1.keys() & dict2.keys() # 交集 dict1.keys() - dict2.keys(
阅读全文
posted @ 2024-02-20 22:53
02 2024 档案
摘要:问题: 如何查找在两个字典中相同的键、值元素? dict1 = {'a': 1, 'b': 2, 'c': 3} dict2 = {'a': 10, 'y': 11,'b': 2} dict1.keys() & dict2.keys() # 交集 dict1.keys() - dict2.keys(
阅读全文
posted @ 2024-02-20 22:53
摘要:关于zip()函数,有几点要讲的。 首先,官方文档中,它是这样描述的: Make an iterator that aggregates elements from each of the iterables. Returns an iterator of tuples, where the i-t
阅读全文
posted @ 2024-02-20 17:55
|
||