Re: Iterate through a dictionary of lists one "line" at a time

2007-04-19 Thread Maric Michaud
wswilson a écrit : > Here is my code: > > listing = {'id': ['a', 'b', 'c'], 'name': ['Joe', 'Jane', 'Bob']} > > I need to output: > > id name > a Joe > b Jane > c Bob > > I could do: > > print 'id', 'name' > for id, name in zip(listing['id'], listing['name']): print id, name > > but that only

RE: Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of wswilson > Sent: Wednesday, April 18, 2007 1:39 PM > To: python-list@python.org > Subject: Iterate through a dictionary of lists one "line" at a time > > He

Re: Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread wswilson
On Apr 18, 2:54 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Apr 18, 7:39 pm, wswilson <[EMAIL PROTECTED]> wrote: > > > > > Here is my code: > > > listing = {'id': ['a', 'b', 'c'], 'name': ['Joe', 'Jane', 'Bob']} > > > I need to output: > > > id name > > a Joe > > b Jane > > c Bob > > > I c

Re: Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread Steve Holden
wswilson wrote: > Here is my code: > > listing = {'id': ['a', 'b', 'c'], 'name': ['Joe', 'Jane', 'Bob']} > > I need to output: > > id name > a Joe > b Jane > c Bob > > I could do: > > print 'id', 'name' > for id, name in zip(listing['id'], listing['name']): print id, name > > but that only wo

Re: Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread Arnaud Delobelle
On Apr 18, 7:39 pm, wswilson <[EMAIL PROTECTED]> wrote: > Here is my code: > > listing = {'id': ['a', 'b', 'c'], 'name': ['Joe', 'Jane', 'Bob']} > > I need to output: > > id name > a Joe > b Jane > c Bob > > I could do: > > print 'id', 'name' > for id, name in zip(listing['id'], listing['name']): p

Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread wswilson
Here is my code: listing = {'id': ['a', 'b', 'c'], 'name': ['Joe', 'Jane', 'Bob']} I need to output: id name a Joe b Jane c Bob I could do: print 'id', 'name' for id, name in zip(listing['id'], listing['name']): print id, name but that only works if there are two entries in the dictionary, id