Sorting dictionary by 'sub' value

From: Rory Campbell-Lange (rory_at_campbell-lange.net)
Date: 03/08/05


Date: Tue, 8 Mar 2005 13:28:00 +0000
To: python-list@python.org

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

    {'now' : datetime.date(2005, 3, 7),
    'y' : (0x011B) Ratio=72 @ 182,
    'ctime' : datetime.date(2005, 3, 7),
    'width' : (0xA002) Long=1024 @ 434,
    'length' : (0xA003) Long=768 @ 446,
    'date' : (0x9004) ASCII=2004:12:07 00:18:20 @ 514,
    'x' : (0x011A) Ratio=72 @ 174,
    'model' : (0x0110) ASCII=PENTAX Optio 330 @ 156,
    'size' : 367415L,
    'orientation' : (0x0112) Short=1 @ 42}

Thanks,
Rory

-- 
Rory Campbell-Lange 
<rory@campbell-lange.net>
<www.campbell-lange.net>


Relevant Pages

  • Re: How to "remember" sort order by user
    ... you're welcome, Robin;) happy to help ... remote programming and training ... The structure was quite similar I just needed to add the additional table to record the sort preferences, ... Rather the Images come in to the program and are named by what ever the primary key is set to at the time. ...
    (microsoft.public.access.forms)
  • Re: How to "remember" sort order by user
    ... Don't know how your data is structured, but, since you have several shots of the the same auto from different views, I would recommend something like this: ... remote programming and training ... Users wanting a different sort per user rather than just not asc/desc. ... Rather the Images come in to the program and are named by what ever the primary key is set to at the time. ...
    (microsoft.public.access.forms)
  • Re: How to "remember" sort order by user
    ... different sort per user rather than just not asc/desc. ... remote programming and training ... Images come in to the program and are named by what ever the primary key is ... It seems that if I just remove the sort from the query and the form that all ...
    (microsoft.public.access.forms)
  • Re: How to "remember" sort order by user
    ... Ordr, integer ... The users are not trying to sort Ascending or Descending. ... Rather the Images come in to the program and are named by what ever the primary key is set to at the time. ... But when the form is closed the sort order is gone and reappears the same as before the user sorted because of the underlying query sort when the form loads. ...
    (microsoft.public.access.forms)
  • Re: Pythons simplicity philosophy
    ... > Python implementation might like to implement the ... That's not a problem with Jython, since Java has a stable sort, see ... There was a OCaml implemenation of a Python variant, ...
    (comp.lang.python)