标签:style 字典 turn dict print span return list 代码
两个list合并为字典的代码如下:
def Run(): list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", "b", "c", "d","e"]; dict={}; i=0; length=len(list2); while i<length: ‘dict[list2[i]]=list3[i];这种方法也可以‘ dit={list2[i]:list3[i]}; dict.update(dit); i+=1; return dict; if __name__ == ‘__main__‘: print Run();
标签:style 字典 turn dict print span return list 代码
原文地址:http://www.cnblogs.com/mlmy/p/6308625.html