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'))
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
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
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
> 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]
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]: