Ben Finney <ben+pyt...@benfinney.id.au> Wrote in message: > Denis McMahon <denismfmcma...@gmail.com> writes: > >> Hi >> >> Given x,y are a lists of keys and value that I wish to combine to a >> dictionary, such that x[n] is the key for value y[n], which is preferred: >> >> z = {a:b for (a,b) in zip(x,y)} > > This one, with the caveat to use PEP-8 compatible formatting:: > > z = {a: b for (a, b) in zip(x, y)}
Or just z = dict(zip (x, y)) > -- DaveA -- https://mail.python.org/mailman/listinfo/python-list