Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Dict comp help

Thread Tools

Re: Dict comp help

Dave Angel
Posts: n/a
On 01/24/2013 03:58 PM, Joseph L. Casale wrote:
> Hi,
> Slightly different take on an old problem, I have a list of dicts, I need to build one dict
> from this based on two values from each dict in the list. Each of the dicts in the list have
> similar key names, but values of course differ.
> [{'a': 'xx', 'b': 'yy', 'c': 'zz'}, {'a': 'dd', 'b': 'ee', 'c': 'ff'}]
> { 'xx': 'zz', 'dd': 'ff'}
> Anyone have insight on how to pull this off?

Not till you tell us what the pattern is supposed to be. I can see how
you might want xx:dd, yy:ee, zz:ff but have no idea what the intended
connection is between the source dicts and the result.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.python,, comp.arch.embedded, comp.programming, comp.text.txt Python 1 10-23-2006 02:47 AM,,comp.lang.python,comp.os.magic-cap, . Python 0 06-19-2004 08:23 AM
misc.survivalism,comp.text.xml,,,comp.os.linux.development.system . XML 0 06-19-2004 08:15 AM
comp.lang.c++,comp.dcom.fax,comp.mail.misc,,comp.sys.amiga.networking . C++ 0 06-19-2004 07:54 AM,,,comp.databases.paradox, . Cisco 0 06-19-2004 07:48 AM