On 26/02/14 07:04, Santosh Kumar wrote:

I defined a dictionary a below.

In [14]: a = {'a':1,'b':2,'c':3}
...
Funtion associated with dictionaries.

In [11]: print a.viewkeys()
dict_keys(['a', 'c', 'b'])

In [12]: print a.viewvalues()
dict_values([1, 3, 2])

In [13]: print a.viewitems()
dict_items([('a', 1), ('c', 3), ('b', 2)])

Where do i use these , can i get any user cases.

What is 'these'?
Do you mean:

1) where do I use a dictionary?
2) where do I use viewXXX()?
3) How do viewXXX differ from XXX (eg a.viewkeys v a.keys)?

I'm not sure which aspect you want help with?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to