sorted reviews in alphabetical order

master
Anton Lydike 2 years ago
parent dc9676155d
commit c902343c87

@ -324,7 +324,7 @@ if __name__ == '__main__':
reviews = ReviewPostprocessor().process_all(parser.parse()) reviews = ReviewPostprocessor().process_all(parser.parse())
with open("reviews.json", 'w') as f: with open("reviews.json", 'w') as f:
json.dump({ json.dump({
'reviews': reviews, 'reviews': sorted(reviews, key=lambda review: tuple((review[key] or '').lower() for key in ('company', 'name', 'variant'))),
'created': str(datetime.date.today()) 'created': str(datetime.date.today())
}, f, indent=2) }, f, indent=2)
except ParseError as err: except ParseError as err:

Loading…
Cancel
Save