# import collections # # print(collections.__all__) # print(dir(collections)) # # d = {} # d.setdefault(2, []).append(23) # d.setdefault(2, []).append(11) # print(d) # d.setdefault(2, []).append(23) # # # 定义一个curry风格函数 # x = lambda y: [ # print(y), # print("..."), # x # ][-1] # print(x(1)(2)) # # import heapq # print(heapq.nlargest(1, [ # {'S': 5, 'H': 3}, # {'S': 7, 'H': 1}, # {'S': 0, 'H': 2} # ], key=lambda x: x['S'])) # # s = [1, [2, [3, [4, [5, 6], 7], 8], (9, 0)]] # f = lambda x: [y for _x in x for y in f(_x)] if isinstance(x, (list, tuple)) else [x] # # print(f(s)) # [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]