Re: python, sorting a dict/json

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Bushroe
Date:  
To: plug-discuss
Subject: Re: python, sorting a dict/json
open parses the json file into a python dictionary. Currently the format
of your json will produce a dictionary with one key 'pubs' and a value
formatted as a python list of nested dictionaries.

>
> The for loop targets the list inside the main dictionary and first
> converts the date to a python date object.
>
> Then simply use the sorted method with a lambda expression to sort the
> order of dictionaries by the newly created date objects.
>
> Yur initial date values are integers. You will need to either store them
> in the json object as strings or convert them so that datetime.strptime()
> can parse them.
>
> I'm sure there are other ways to do this but this was the fastest given
> the json format.
>
> 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
>>
> --


definitely use multiple search indexes. If the search is vague for
publication but occurred with in some time range, you would need to search
the entire file to be sure that you didn't have it, and also complete the
other searches faster.

Display possibility is to list the current name and publication in the
center, then any newer papers above their current entry and older articles
bellow. The next name with just the name on the main line, and then a
abbreviated publication name, date, and on the line just below it the first
3 or 4 significant words in the article title, then 2 blank lines to make
the current name stand out. For authors with few papers in that time period
leave blanks spots, for authors with lots of publications shrink the space
between to only 1. Use the four arrow keys to make short moves, type in
partial names for a list of possible matching items.

Have you considered value added? For instance, add one or more fields for
subject matter, quality of added data.

I would also recommend storing the data (plus reference link) locally. Data
on the web as a tendency to keep moving or disappearing altogether.
"Creativity is intelligence having fun." — Albert Einstein

Misha
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss