I have made a program that reads from a csv file, with this code;
reader = csv.DictReader(open('FakeNameSet.csv', 'r', encoding='utf-8-sig'))
customer_list = []
for line in reader:
customer_list.append(line)
This code creates these types of ordered dictionaries from my csv file;
OrderedDict([('Number', '19'),
('Gender', 'female'),
('NameSet', 'Dutch'),
('GivenName', 'Özgül'),
('Surname', 'Overgaauw'),
('StreetAddress', 'Adriana Noorlandersingel 200'),
('ZipCode', '3065 HE'),
('City', 'Rotterdam'),
('EmailAddress', 'OzgulOvergaauw@superrito.com'),
('Username', 'Shrothem1971'),
('TelephoneNumber', '06-15253488')]),
OrderedDict([('Number', '20'),
('Gender', 'female'),
('NameSet', 'Dutch'),
('GivenName', 'Gülseren'),
('Surname', 'Willigenburg'),
('StreetAddress', 'Dingspelstraat 28'),
('ZipCode', '9461 JE'),
('City', 'Gieten'),
('EmailAddress', 'GulserenWilligenburg@teleworm.us'),
('Username', 'Ressoare'),
('TelephoneNumber', '06-92433659')])]
Now I need to access the people in this list by name, but I have no idea how to access the name in this OrderedDict
style. I've been trying for 2 hours and nothing seems to be working.
So basically, I have a list with a number of these ordered dictionaries and I want to search for a particular person in these dictionaries; so basically a function that works as follows;
Search_for_person("Gülseren")
, and then it returns all the information for that person.