摘要:
""" 4.1 输出1-100除3余1 的数,结果为tuple 输出1-100除3余1 的数,结果为tuple """ a = [j for j in range(1,101) if j % 3==1] print(set(a)) """ 4.2 把2个元祖转字典 将('a', 'b', 'c', 阅读全文
posted @ 2021-07-06 14:23
美女爱找茬
阅读(334)
评论(0)
推荐(0)
摘要:
defaultdict : dict 子类调用工厂函数来提供缺失值 from collections import defaultdict #第一种写法 s = [('yellow',1),('blue',2),('yellow',3),('blue',4),('red',5)] d=default 阅读全文
posted @ 2021-07-06 13:15
美女爱找茬
阅读(115)
评论(0)
推荐(0)
摘要:
deque: (double-ended queue,双端队列),是一种具有队列和栈性质的数据结构,双端队列中的元素可以从两端弹出,相比list增加[]运算符重载 #1、append(x) ,将x添加到deque的右侧: from collections import deque d = deque 阅读全文
posted @ 2021-07-06 13:13
美女爱找茬
阅读(246)
评论(0)
推荐(0)

浙公网安备 33010602011771号