for example this is the data:
data = {'number': 3, 'message': 'success', 'people': [{'craft': 'ISS', 'name': 'Chris Cassidy'}, {'craft': 'ISS', 'name': 'Anatoly Ivanishin'}, {'craft': 'ISS', 'name': 'Ivan Vagner'}]}
how do I print only the names of the people in this case?
required output:
('Chris Cassidy', 'Anatoly Ivanishin', 'Ivan Vagner')
I can't wrap my head around this, please help. :)
Try:
names = []
for person in data["people"]:
names.append(person["name"])
names
will then have your desired list.