Re: Creating dict from keys and values

2005-05-29 Thread Just
In article <[EMAIL PROTECTED]>, Dirkjan Ochtman <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm looking for an intuitive way of creating a dict from what the > dict.keys() and dict.values() will return (two lists). > > Currently, I'm using this code: > > > d = {} > > for i in range(len(data)):

Creating dict from keys and values

2005-05-29 Thread Dirkjan Ochtman
Hi there, I'm looking for an intuitive way of creating a dict from what the dict.keys() and dict.values() will return (two lists). Currently, I'm using this code: > d = {} > for i in range(len(data)): > d[header[i]] = data[i] But this feels kind of inelegant. So: is there a better way?