Python 3: Plist as OrderedDict

Stephen Hansen apt.shansen at
Tue Feb 9 18:06:42 CET 2010

On Tue, Feb 9, 2010 at 8:07 AM, Gnarlodious <gnarlodious at> wrote:

> To extract the list I am saying this:
> ordered=plistlib.readPlist(path)
> print(list(ordered))  # only a list of keys
> print(ordered[list(ordered)[0]])
> However this seems too laborious. is there an easier way?

I'm not familiar with plistlib or what you're trying to do-- it'd help if
you provided the output from those print's, as I don't have a plist on hand
which I can use to test it out and see what you're seeing.

But, is "ordered.keys()" or "ordered.items()" what you're trying to get? Or,
ordered[ordered.keys()[0]] to get the first one? Or "for key in ordered:
print(ordered[key])" which will get the keys in order and print the values
according to that order?

Basically, I'm not sure what you're actually trying to do.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list