Python 3: Plist as OrderedDict

Gnarlodious gnarlodious at
Tue Feb 9 17:07:42 CET 2010

On Feb 9, 12:15 am, Raymond Hettinger wrote:

> You may be able to monkey patch an OrderedDict into the PlistParser.
> Here's an untested stab at it:
>     from collections import OrderedDict
>     import plistlib
>     plistlib._InteralDict = OrderedDict

Genius! After fixing the misspelled InteralDict I got this:

from collections import OrderedDict
import plistlib
plistlib._InternalDict = OrderedDict
--> OrderedDict([('List', 'of'), ('tuples', 'in'), ('plist',

So thank you for that [somewhat contorted] solution.
To extract the list I am saying this:

print(list(ordered))  # only a list of keys

However this seems too laborious. is there an easier way?

-- Gnarlie

More information about the Python-list mailing list