On Tue, Oct 25, 2011 at 9:45 AM, ADRIAN KELLY <kellyadr...@hotmail.com>wrote:
> if i have a dictionary called definitions is there a way of printing the > keys and not the values that go with them? > > thanks so much > > > > Adrian > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > The python.org documentation is a good place to learn about dictionaries. http://docs.python.org/library/stdtypes.html#mapping-types-dict As it turns out, you can iterate over the keys of a dictionary: >>> definitions = {'k1':'k1 value', 'k2': 'k2 value'} >>> for k in definitions: ... print k ... k2 k1 -- Joel Goldstick
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor