0

I have this code:

charlie = {"animal_kind":"german shepherd","owner's_name":"cory", } 
lucy = {"animal_kind":"cat", "owner's_name":"oliver"}
george = {"animal_kind":"ferret", "owner's_name":"stephy"}

pets = [charlie, lucy, george]

I want to loop through each dictionary and print the dictionary's name (not the keys or values in the dictionaries). Is there a way to do that?

Martin Dimitrov
  • 349
  • 1
  • 3
  • 11
  • Definitely a duplicate, but you also should know that the answer to this depends on what version of Python you are running. – Jaxian Jun 20 '16 at 16:41
  • Hmm, this may not be possible: http://stackoverflow.com/questions/544919/can-i-print-original-variables-name-in-python – Jaxian Jun 20 '16 at 16:49

0 Answers0