[Tutor] OrderedDict?

Alan Gauld alan.gauld at yahoo.co.uk
Wed Jun 1 18:45:42 EDT 2016


On 01/06/16 16:36, Alex Hall wrote:

> I'm trying to find the OrderedDict documentation. I found one page, but it
> wasn't very clear on how to actually make an OrderedDict. Plus, an empty
> constructor in Python's interpreter returns an error that the class doesn't
> exist

It's in the collections module:

>>> import collections as coll
>>> help(coll.OrderedDict)
...
>>> od = coll.OrderedDict()
>>> od
OrderedDict()
>>>


HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list