10.有字符串 "k:1|k1:2|k2:3|k3:4" 处理成字典 {'k':1,'k1':2....}s = "k:1|k1:2|k2:3|k3:4" dic = {} l1 = s.split('|') for i in l1: k,v = i.split(':') dic[k] = v print(dic)