两个列表提取作为字典,dict(zip(list1, list2))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author:九九的金金子
list1 = ["a", "b"]
list2 = [1, 2]
print(dict(zip(list1, list2)))
运行结果:{'a': 1, 'b': 2}
两个列表提取作为字典,dict(zip(list1, list2))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author:九九的金金子
list1 = ["a", "b"]
list2 = [1, 2]
print(dict(zip(list1, list2)))
运行结果:{'a': 1, 'b': 2}