Python Forum
function for extracting data from lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function for extracting data from lists
#2
You need to iterate through the list, check if key in in the dictionary, and if so display results

pseudo code:
for each item in list_1
    for each key in keys
        display key and value (no newline)
    display newline
to display without newline, use like: print(f"{key:8} {adict[key]:10} ", end="")
the :8 and :10 are qualifiers that indicate width of field.
Paulman likes this post
Reply


Messages In This Thread
RE: function for extracting data from lists - by Larz60+ - Nov-08-2021, 02:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Recursive Function - Compare 2 lists, return the elements that don't exist in both KellyBaptist 1 6,321 Dec-23-2018, 10:10 AM
Last Post: Gribouillis
  Questions on lists, the range function & concatenation fad3r 7 5,725 Jan-25-2018, 03:11 PM
Last Post: fad3r
  How to extract two data types from a text file and store them as two separate lists banf 1 4,068 Jan-16-2017, 09:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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