Python Forum
access dictionary with keys from another and write values to list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
access dictionary with keys from another and write values to list
#3
Thanks for the quick answer... can anyone give me a quick example how to loop over it?

The dictionary part of my code looks like this:


d11=dict()
for a in range(len(GN)):
    d11[a]=GN[a]


listOfKeys = list()
listOfItems = d11.items()
for item  in listOfItems:
    if item[1] == ' 11':
        listOfKeys.append(item[0])
        

d11x=dict()
for m in range(len(GN)):
    d11x[m]=x[m]
How can I get the corresponding values to a new list?
Reply


Messages In This Thread
RE: access dictionary with keys from another and write values to list - by redminote4dd - Jun-03-2020, 12:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 581 Apr-29-2024, 04:38 PM
Last Post: Calab
Question Using Lists as Dictionary Values bfallert 8 381 Apr-21-2024, 06:55 AM
Last Post: Pedroski55
  Dictionary in a list bashage 2 585 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  How to access values returned from inquirer cspower 6 871 Dec-26-2023, 09:34 PM
Last Post: cspower
  filtering a list of dictionary as per given criteria jss 5 728 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  need to compare 2 values in a nested dictionary jss 2 893 Nov-30-2023, 03:17 PM
Last Post: Pedroski55
  Copying the order of another list with identical values gohanhango 7 1,188 Nov-29-2023, 09:17 PM
Last Post: Pedroski55
  Search Excel File with a list of values huzzug 4 1,285 Nov-03-2023, 05:35 PM
Last Post: huzzug
  Access list of dictionaries britesc 4 1,101 Jul-26-2023, 05:00 AM
Last Post: Pedroski55
  Comparing List values to get indexes Edward_ 7 1,215 Jun-09-2023, 04:57 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020