lis = [ ["王*龙",'北京市海淀区苏州街大恒科技大厦南做4层'], ['庞*飞','北京市仓平区汇德商厦四楼403'], ['顾*锐','江苏省扬州市三垛镇工业集中区扬州市理化生情有限公司'], ['王*飞','上海市徐汇区上海市徐汇区H88越共广场B←5E'], ['华*升','北京市海淀区捷瑞大厦'], ['朱*锴','上海市浦东新区川沙新镇华川家园33楼503'] ] new_lis = [ [], [], [], ] new_dic = {} for i in lis : if i[1][:3] == "北京市": new_lis[0].append(i) new_dic["北京市"] = new_lis[0] elif i[1][:3] == "上海市": new_lis[1].append(i) new_dic["上海市"] = new_lis[1] for k in new_dic: print(k,new_dic[k])
08-03
483
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-05
517
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-07
1218
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)