python, sorting a dict/json

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: der.hans
Fecha:  
A: quatsch
Asunto: python, sorting a dict/json
moin moin,

I'm trying to sort some data that is currently in json being imported into
a dict.

It's essentially bibliography information, but without a unique ID.

I mostly want to sort on publication date, but also want to group by
publication. There could be multiple publications on the same date.

Currently using a json format like:

{
  "pubs": [
   {
    "date": 20190222
    "title": "a title"
    "url": "https://some.domain/page.html"
   },
   {
    "date": 20190221
    "title": "another title"
    "url": "https://some.other.domain/page.html"
   }
  ]
}


Format can change if that helps.

I want to be able to display items in order. Mostly chronological, but
also by other details.

Any suggestions for how to sort them for display?

A nice, but not required, feature would be sorting them for saving to disk
as well.

ciao,

der.hans
--
# https://www.LuftHans.com https://www.PhxLinux.org
# "You want weapons? We're in a library! Books! The best weapons in the
# world! This room's the greatest arsenal we could have - arm yourselves!"
# -- the Doctor: Doctor Who, Tooth and Claw, 2006
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss