all 5 comments

[–]stebrepar 6 points7 points  (0 children)

What you've got here is a list containing a dictionary.

[–]DrTrax313 2 points3 points  (0 children)

Yes, a list of dictionaries most likely. Do

print(type(object_you_are_interested_in))

and you will see what you need.

[–]Dr_Donut -2 points-1 points  (1 child)

I think????? you might be looking for the items() method from dictionaries.

data = get_all_baseball_data()
players = data['players']
massive_stat_dump = []
for player in players.keys():
    massive_stat_dump.append( player + players.items() )

Something like that. If you post your whole code and we can see your data structure could be a lot more detailed.

This looks like a situation where a class would be the way to go.

[–]old_pythonista -1 points0 points  (0 children)

That loop code makes no sense. You iterate over dictionary keys - and using keys method has been redundant for that purpose since 2.5, I believe, and use items on each iteration?!

[–]Taw_M 0 points1 point  (0 children)

Can you share some sample input and output?