Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Steven Bethard
Rory Campbell-Lange wrote: Thank you all very much for your help. I did the following and it works: imgs=v.keys() imgs.sort(lambda a,b: cmp( time.strptime(str(v[a][9]['date']), '%Y:%m:%d %H:%M:%S'), time.strptime(str(v[b][9]['date']), '%Y:%m:%d %H:%M:%S'))

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
Thank you all very much for your help. I did the following and it works: imgs=v.keys() imgs.sort(lambda a,b: cmp( time.strptime(str(v[a][9]['date']), '%Y:%m:%d %H:%M:%S'), time.strptime(str(v[b][9]['date']), '%Y:%m:%d %H:%M:%S')) ) for i in img

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Scott David Daniels
Diez B. Roggisch wrote: I have a dictionary of images. I wish to sort the dictionary 'v' by a dictionary value using python 2.3. The dictionary value is the date attribute as shown here: v[imagename][9]['date'] ... You can't sort dicts - they don't impose an order on either key or value. There a

RE: Sorting dictionary by 'sub' value

2005-03-08 Thread Batista, Facundo
Title: RE: Sorting dictionary by 'sub' value [Rory Campbell-Lange] #- I have a dictionary of images. I wish to sort the dictionary 'v' by a #- dictionary value using python 2.3. The dictionary value is the date #- attribute as shown here: You have to use the DSU algor

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Diez B. Roggisch
> I have a dictionary of images. I wish to sort the dictionary 'v' by a > dictionary value using python 2.3. The dictionary value is the date > attribute as shown here: > > v[imagename][9]['date'] > > This attribute is an extracted EXIF value from the following set: > > data element [9]

Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
I have a dictionary of images. I wish to sort the dictionary 'v' by a dictionary value using python 2.3. The dictionary value is the date attribute as shown here: v[imagename][9]['date'] This attribute is an extracted EXIF value from the following set: data element [9] of v[imagename]: