phpにあるarray_combine
がしたかったので、こんな感じでやってみました。
key = ['key1', 'key2', 'key3']
value = ['おこめ' , 'ごはん', 'らいす']
combined = {k:v for k,v in zip(key, value)}
print(combined)
{'key1': 'おこめ', 'key2': 'ごはん', 'key3': 'らいす'}
phpにあるarray_combine
がしたかったので、こんな感じでやってみました。
key = ['key1', 'key2', 'key3']
value = ['おこめ' , 'ごはん', 'らいす']
combined = {k:v for k,v in zip(key, value)}
print(combined)
{'key1': 'おこめ', 'key2': 'ごはん', 'key3': 'らいす'}