data = [
{
'name': 'Instagram',
'follower_count': 346,
'description': 'Social media platform',
'country': 'United States'
},
{
'name': 'Cristiano Ronaldo',
'follower_count': 215,
'description': 'Footballer',
'country': 'Portugal'
}]
how to print follower_count of any one of tthe two given dict
CodePudding user response:
You have a list of dictionaries, so what you’ll need to do is first index the array before accessing the follower count.
Something like:
data[i][“follower_count”]
Where i
is some index in the array.
CodePudding user response:
Basically, just select the dict you want (0 if you want the first) and then select the 'follower_count' value like so:
data[0]['follower_count']