摘要: #字典推倒 dial_codes = [(86,'china'),(91,'india'),(1,'us'),(62,'indos'),(55,'brazil'),(92,'pakitan'),(7,'russia')] country_code = {country:code for code,country in dial_codes} # 字典推导式 print(country_code... 阅读全文
posted @ 2018-01-12 18:10 Erick-LONG 阅读(241) 评论(0) 推荐(0) 编辑
摘要: from collections import deque dq = deque(range(10),maxlen=10) dq.rotate(3)#队列旋转操作接受一个参数N,让N>0时,队列的最右边N个元素会被移动到队列最左边,反之会移到队列最右边 dq.appendleft(-1)#头部添加 dq.extend([11,22,33])#尾部添加 dq.extendleft([10,20... 阅读全文
posted @ 2018-01-12 16:40 Erick-LONG 阅读(317) 评论(0) 推荐(0) 编辑