What's the Pythonic way to combine two sequences into a dictionary?

前端 未结 2 1295
夕颜
夕颜 2020-12-16 22:28

Is there a more concise way of doing this in Python?:

def toDict(keys, values):
  d = dict()
  for k,v in zip(keys, values):
    d[k] = v

  return d
         


        
2条回答
提交回复
热议问题