> How would I modify this to just print either the values or keys?

Just ask for the values or the keys!

for value in pairs.values()
     print value

for key in pairs.keys()
     print key

for key,value in pairs.items()
    print key
    print value

Dictionaries are extremely powerful data containers.

HTH,

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to