Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python dictionary help
#1
Hello,

I accessed an API and I got this below.

How can I extract the email_address and FNAME from this dictionary?

>>> type(b)
<class 'dict'>
>>> print(b)
{'members': [{'id': 'f149ad5b63bba504497687010d4809bd', 'email_address': '[email protected]', 'merge_fields': {'FNAME': 'Pepe', 'LNAME': 'Lopez', 'ADDRESS': {'addr1': '', 'addr2': '', 'city': '', 'state': '', 'zip': '', 'country': 'US'}, 'PHONE': '', 'BIRTHDAY': ''}}, {'id': '58ccf84f5702a7be79e06fd6ed933d37', 'email_address': '[email protected]', 'merge_fields': {'FNAME': 'Marc', 'LNAME': 'Perez', 'ADDRESS': '', 'PHONE': '', 'BIRTHDAY': ''}}]}
>>> print(b.keys())
dict_keys(['members'])
>>> print(b.values())
dict_values([[{'id': 'f149ad5b63bba504497687010d4809bd', 'email_address': '[email protected]', 'merge_fields': {'FNAME': 'Pepe', 'LNAME': 'Lopez', 'ADDRESS': {'addr1': '', 'addr2': '', 'city': '', 'state': '', 'zip': '', 'country': 'US'}, 'PHONE': '', 'BIRTHDAY': ''}}, {'id': '58ccf84f5702a7be79e06fd6ed933d37', 'email_address': '[email protected]', 'merge_fields': {'FNAME': 'Marc', 'LNAME': 'Perez', 'ADDRESS': '', 'PHONE': '', 'BIRTHDAY': ''}}]])
Thanks
Reply


Messages In This Thread
Python dictionary help - by kamaleon - Dec-30-2019, 05:54 PM
RE: Python dictionary help - by buran - Dec-30-2019, 06:03 PM
RE: Python dictionary help - by ichabod801 - Dec-30-2019, 06:05 PM
RE: Python dictionary help - by kamaleon - Dec-30-2019, 06:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert List of Dictionary to dictionary of dictionary list in python kk230689 2 57,751 Apr-27-2019, 03:13 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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