博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2024年2月20日

摘要: 问题: 如何查找在两个字典中相同的键、值元素? 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 生活旅行家 阅读(61) 评论(0) 推荐(0)

摘要: 关于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 生活旅行家 阅读(28) 评论(0) 推荐(0)