Jun-29-2022, 04:25 PM
Hi, one more question for the day.
This is a list - my_List = ["one", "two","three"]
This is a dictionary - my_Dict = dict({1: 'Geeks', 2: 'For', 3:'Geeks'})
What is this then? This has multiple delimiters enclosed in the list[] ... {}'s, :'s and []'s
<class 'list'>
Traceback (most recent call last):
File "<string>", line 26, in <module>
AttributeError: 'list' object has no attribute 'name'
Thanks
This is a list - my_List = ["one", "two","three"]
This is a dictionary - my_Dict = dict({1: 'Geeks', 2: 'For', 3:'Geeks'})
What is this then? This has multiple delimiters enclosed in the list[] ... {}'s, :'s and []'s
applicants = [
{
"name": "Devon Smith",
"programming_languages": ["c++", "ada"],
"years_of_experience": 1,
"has_degree": False,
"email_address": "[email protected]",
},
{
"name": "Susan Jones",
"programming_languages": ["python", "javascript"],
"years_of_experience": 2,
"has_degree": False,
"email_address": "[email protected]",
},
{
"name": "Sam Hughes",
"programming_languages": ["java"],
"years_of_experience": 4,
"has_degree": True,
"email_address": "[email protected]",
},
]
print (type(applicants))
print (applicants.name)OUTPUT:<class 'list'>
Traceback (most recent call last):
File "<string>", line 26, in <module>
AttributeError: 'list' object has no attribute 'name'
Thanks
