python一次输入多个数:
list = [x for x in input().split()]
创建列表的方法:
1:dic = dict(zip(list1,list2))
2:dict[key] = value
按字典的键或者值排序:
sorted(dic.item(),key = lambda d:d[0])#或者d[1]
#对多维数组排序
#按第二个数排序
k = [[10,30],[20,60],[80,100],[5,180]]
k.sort(key=lambda x:x[1])
print(k)
遍历列表生成字典:
if i not in dic.keys():
dic[i] = 1
else:
dic[i] += 1