[FRPythoneers] sorting a list of dictionaries

Andrew Diederich diederic at boulder.net
Mon Jan 20 19:18:18 MST 2003


On Mon, 20 Jan 2003, Cary Miller wrote:

> Could you post an example of one of these data structures?

Absolutely.  The first one has the dn at the front, the second does not.
That should be the only difference.  Both are just my entry.  

Looks like I was smoking crack earlier -- the default result set is a list
of tuples.  The first in the tuple is a string (the dn) and the second is
the dictionary.

straight:

[('cn=andrew,cn=Recipients,ou=ND,o=NETdelivery', {'rdn': ['andrew'],
'mail': 

['andrew at NETdelivery.com'], 'department': ['Customer Support'], 'sn':
['Diederich'], 

'MAPI-Recipient': ['TRUE'], 'manager':
['cn=tholder,cn=Recipients,ou=ND,o=NETdelivery'], 

'uid': ['andrew'], 'mobile': ['303-523-9153'], 'distinguishedName': 

['cn=andrew,cn=Recipients,ou=ND,o=NETdelivery'], 'rfc822Mailbox': 

['andrew at NETdelivery.com'], 'objectClass': ['organizationalPerson',
'person', 'Top'], 

'givenName': ['Andrew'], 'otherMailbox': ['CCMAIL$Diederich, Andrew at
ND', 'MBX$1', 

'MS$NETDELIVER/ND/ANDREW', 'smtp$andrew.diederich at netdelivery.com', 

'smtp$andrew at idkenterprises.net'], 'conferenceInformation': ['/'],
'telephoneNumber': 

['366'], 'textEncodedORaddress': ['c=US;a=
;p=NETdelivery;o=ND;s=andrew;'], 'title': 

['Manager, Customer Support'], 'cn': ['Andrew Diederich']})]


Modified:
[{'rdn': ['andrew'], 'mail': ['andrew at NETdelivery.com'], 'department':
['Customer Support'], 'sn': ['Diederich'], 'MAPI-Recipient': ['TRUE'],
'manager': ['cn=tholder,cn=Recipients,ou=ND,o=NETdelivery'], 'uid':
['andrew'], 'mobile': ['303-523-9153'], 'distinguishedName':
['cn=andrew,cn=Recipients,ou=ND,o=NETdelivery'], 'rfc822Mailbox':
['andrew at NETdelivery.com'], 'objectClass': ['organizationalPerson',
'person', 'Top'], 'givenName': ['Andrew'], 'otherMailbox':
['CCMAIL$Diederich, Andrew at ND', 'MBX$1', 'MS$NETDELIVER/ND/ANDREW',
'smtp$andrew.diederich at netdelivery.com',
'smtp$andrew at idkenterprises.net'], 'conferenceInformation': ['/'],
'telephoneNumber': ['366'], 'textEncodedORaddress': ['c=US;a=
;p=NETdelivery;o=ND;s=andrew;'], 'title': ['Manager, Customer Support'],
'cn': ['Andrew Diederich']}] 




More information about the FRPythoneers mailing list