Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:07 AM, Gnarlodious 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 p

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Gnarlodious
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 Inter

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Gnarlodious
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 Inte

Re: Python 3: Plist as OrderedDict

2010-02-08 Thread Raymond Hettinger
On Feb 8, 8:02 pm, Gnarlodious wrote: > I am trying to read a *.plist into Python 3's OrderedDict but can't > figure it out. Saying something like this: ... > I "upgraded" to Py3 to have OrderedDict, so please don't say it is > impossible... You may be able to monkey patch an OrderedDict into the

Re: Python 3: Plist as OrderedDict

2010-02-08 Thread Ned Deily
In article , Terry Reedy wrote: > On 2/8/2010 11:02 PM, Gnarlodious wrote: > > I am trying to read a *.plist into Python 3's OrderedDict but can't > > figure it out. Saying something like this: > > from plistlib import readPlist > As a general note, include a link or something when discussing a

Re: Python 3: Plist as OrderedDict

2010-02-08 Thread Terry Reedy
On 2/8/2010 11:02 PM, Gnarlodious wrote: I am trying to read a *.plist into Python 3's OrderedDict but can't figure it out. Saying something like this: from plistlib import readPlist As a general note, include a link or something when discussing a relatively obscure module that seems not to e

Re: Python 3: Plist as OrderedDict

2010-02-08 Thread Benjamin Kaplan
On Mon, Feb 8, 2010 at 11:02 PM, Gnarlodious wrote: > I am trying to read a *.plist into Python 3's OrderedDict but can't > figure it out. Saying something like this: > > from plistlib import readPlist > dict=readPlist('/path/file.plist') > --> arbitrarily ordered dictionary compared to the XML fi

Re: Python 3: Plist as OrderedDict

2010-02-08 Thread Ben Finney
Gnarlodious writes: > from plistlib import readPlist > dict=readPlist('/path/file.plist') > --> arbitrarily ordered dictionary compared to the XML file Right. The items in a dict are unordered, and when serialised to a list they will appear in an arbitrary, unpredictable order. >>> foo = di