Re: Dict comp help

Discussion in 'Python' started by Dave Angel, Jan 24, 2013.

  1. Dave Angel

    Dave Angel Guest

    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.

    Dave Angel, Jan 24, 2013
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page