【发布时间】:2020-01-28 19:23:09
【问题描述】:
我已尝试解决我的问题,但无法解决。
我有三个 Python 列表:
atr = ['a','b','c']
m = ['h','i','j']
func = ['x','y','z']
我的问题是根据这三个列表的组合生成一个 Python 字典:
想要的输出:
py_dict = {
'a': [('x','h'), ('x','i'), ('x','j'), ('y','h'), ('y','i'), ('y','j'),('z','h'), ('z','i'), ('z','j')],
'b': [('x','h'), ('x','i'), ('x','j'), ('y','h'), ('y','i'), ('y','j'),('z','h'), ('z','i'), ('z','j')],
'c': [('x','h'), ('x','i'), ('x','j'), ('y','h'), ('y','i'), ('y','j'),('z','h'), ('z','i'), ('z','j')]
}
【问题讨论】:
标签: python pandas list dictionary combinations