li =[11,22,33,44,55,66,77,88,99,90]dic={}list_1 =[] #大于66list_2 =[] #小于66for i in li: if i ==66: continue if i > 66: list_1.append(i) else: list_2.append(i)dic.setdefault('k1',list_1)dic.setdefault('k2',list_2)print(dic)
本文共 304 字,大约阅读时间需要 1 分钟。
li =[11,22,33,44,55,66,77,88,99,90]dic={}list_1 =[] #大于66list_2 =[] #小于66for i in li: if i ==66: continue if i > 66: list_1.append(i) else: list_2.append(i)dic.setdefault('k1',list_1)dic.setdefault('k2',list_2)print(dic)
转载于:https://www.cnblogs.com/yuhoucaihong/p/10350377.html