×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    26

    Question get spesific key from dictionary

    from dictionary:

    Code:
    D = {
        'ONE':{
            'AA':{
                'aa1':{
                    'day':'sunday aa1',
                    'month':'january aa1',
                    'year':2009
                    },
                'aa2':{
                    'day':'sunday aa2',
                    'month':'january aa2',
                    'year':2009
                    },
                'aa3':{
                    'day':'sunday aa3',
                    'month':'january aa3',
                    'year':2009
                    }
                },
            'BB':{
                'bb1':{
                    'day':'sunday bb1',
                    'month':'january bb1',
                    'year':2009
                    },
                'bb2':{
                    'day':'sunday bb2',
                    'month':'january bb2',
                    'year':2009
                    },
                'bb3':{
                    'day':'sunday bb3',
                    'month':'january bb3',
                    'year':2009
                    }
                },
            'CC':{
                'cc1':{
                    'day':'sunday cc1',
                    'month':'january cc1',
                    'year':2009
                    },
                'cc2':{
                    'day':'sunday cc2',
                    'month':'january cc2',
                    'year':2009
                    },
                'cc3':{
                    'day':'sunday cc3',
                    'month':'january cc3',
                    'year':2009
                    }
                },
        'TWO':{
            'DD':{
                'dd1':{
                    'day':'sunday dd1',
                    'month':'january dd1',
                    },
                'dd2':{
                    'day':'sunday dd2',
                    'month':'january dd2',
                    },
                'dd3':{
                    'day':'sunday dd3',
                    'month':'january dd3',
                    }
                },
            'EE':{
                'ee1':{
                    'day':'sunday ee1',
                    'month':'january ee1',
                    'year':2009
                    },
                'ee2':{
                    'day':'sunday ee2',
                    'month':'january ee2',
                    },
                'ee3':{
                    'day':'sunday ee3',
                    'month':'january ee3',
                    'year':2009
                    }
                },
            'FF':{
                'ff1':{
                    'day':'sunday ff1',
                    'month':'january ff1',
                    'year':2009
                    },
                'ff2':{
                    'day':'sunday ff2',
                    'month':'january ff2',
                    'year':2009
                    },
                'ff3':{
                    'day':'sunday ff3',
                    'month':'january ff3',
                    'year':2009
                    }
                },
        'THREE':{
            'GG':{
                'gg1':{
                    'day':'sunday gg1',
                    'month':'january gg1',
                    'year':2009
                    },
                'gg2':{
                    'day':'sunday gg2',
                    'month':'january gg2',
                    'year':2009
                    },
                'gg3':{
                    'day':'sunday gg3',
                    'month':'january gg3',
                    'year':2009
                    }
                },
            'HH':{
                'hh1':{
                    'day':'sunday hh1',
                    'month':'january hh1',
                    'year':2009
                    },
                'hh2':{
                    'day':'sunday hh2',
                    'month':'january hh2',
                    'year':2009
                    },
                'hh3':{
                    'day':'sunday hh3',
                    'month':'january hh3',
                    'year':2009
                    }
                },
            'II':{
                'ii1':{
                    'day':'sunday ii1',
                    'month':'january ii1',
                    },
                'ii2':{
                    'day':'sunday ii2',
                    'month':'january ii2',
                    },
                'ii3':{
                    'day':'sunday ii3',
                    'month':'january ii3',
                    }
                },        
        }

    (for example dictionary above,keys that we will get only key that have 'year')
    so the result will be = ['AA', 'BB', 'CC', 'EE', 'FF', 'GG', 'HH']


    is there any efficient ways to get that result ?

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    26

    Re: get spesific key from dictionary

    is there no one can solve this problem?

  3. #3
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: get spesific key from dictionary

    Since this is a question about standard Python you could ask it at the Python mailing list or a Python forum: http://www.python-forum.org/pythonforum/index.php

  4. #4
    Registered User
    Join Date
    Jul 2008
    Posts
    26

    Re: get spesific key from dictionary

    sorry about that. i will try that forum.
    thx for info.

Similar Threads

  1. Replies: 106
    Last Post: 2009-05-11, 05:53
  2. List of Codes for Buttons
    By skela in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2008-05-20, 20:39
  3. Replies: 7
    Last Post: 2007-11-03, 16:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×