diff options
-rw-r--r-- | scripts/rankings-editions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/rankings-editions.py b/scripts/rankings-editions.py index 42d036f..de1f2d6 100644 --- a/scripts/rankings-editions.py +++ b/scripts/rankings-editions.py @@ -1,11 +1,12 @@ import copy, json, sys +from collections import OrderedDict from bs4 import BeautifulSoup as bs4 dates_config = json.load(file('config/dates.json')) output_file = bs4(file(sys.argv[1]), 'lxml') -editions = {} +editions = OrderedDict() for date_config in dates_config: year = date_config['name'].split(' ')[1] if year not in editions: @@ -30,7 +31,7 @@ for year, dates in editions.iteritems(): link['href'] = date[1] link['datetime'] = date[2] group.append(link) - date_group.append(group) + date_group.insert(0, group) output_file.select('#editions')[0].replace_with(date_group) file(sys.argv[1], 'w').write(output_file.prettify().encode('utf-8')) |