摘要: 1,先看赋值运算。 对于赋值运算来说,l1与l2指向的是同一个内存地址,所以他们是完全一样的。 2,浅拷贝copy。 对于浅copy来说,只是在内存中重新创建了开辟了一个空间存放一个新列表,但是新列表中的元素与原列表中的元素是公用的。 3,深拷贝deepcopy。 对于深copy来说,列表是在内存中 阅读全文
posted @ 2018-12-17 19:32 zhaoweibin 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 1 class StackWithTwoQueues: 2 def __init__(self): 3 self.queue1 = [] 4 self.queue2 = [] 5 6 def push(self, item): 7 if len(self.queue1) == 0: 8 se... 阅读全文
posted @ 2018-12-17 19:28 zhaoweibin 阅读(95) 评论(0) 推荐(0) 编辑