Python 3: Plist as OrderedDict
Gnarlodious
gnarlodious at gmail.com
Tue Feb 9 10:21:28 EST 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
plistlib.readPlist('/path/to/some.plist')
--> OrderedDict([('List', 'of'), ('tuples', 'in'), ('plist',
'order')])
So thank you for that [somewhat contorted] solution. (PyN00b): Now how
do I extract the list from the function?
-- Gnarlie
More information about the Python-list
mailing list