![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python数据结构
zhangbigxu
The best is yet to come
展开
-
Python两个字典比较,少key的取0,按照key排序后输出
Python两个字典比较,少key的取0,按照key排序后输出 dica={'a':1,'b':2,'c':3,'d':4} dicb={'a':3,'b':5,'e':7,'c':9,'d':1} print(dica) print(dicb) for k in dicb.keys():#比较两个字典,没有的key的加上该key并取值为0 if k not in dica.keys()...原创 2020-04-17 09:49:30 · 409 阅读 · 0 评论 -
Python数据结构
# author:zhangpengxu #栈 class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self,item): self.items.append(item) ...原创 2019-12-31 09:09:20 · 92 阅读 · 0 评论