Peileppe

dictionnary_test

Feb 24th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. """
  2. trying to understand dictionnary
  3. """
  4. dict1={
  5.     "Menu1":1,
  6.     "Menu2":2,
  7.     "Menu3":3,
  8.     }
  9.  
  10. print dict1.keys()
  11. print dict1.values()
  12. print "---"
  13. print dict1.keys()[0]
  14. print dict1.keys()[2]
  15. print dict1.keys()[1]
  16.  
  17. print "---"
  18. for i, d in enumerate(dict1, start=1):
  19.     print str(i).ljust(2)+d.ljust(13)+str(dict1[d]).ljust(4)
Advertisement
Add Comment
Please, Sign In to add comment