14 lines
389 B
Python
14 lines
389 B
Python
import json
|
|
import sys
|
|
|
|
src = sys.argv[1]
|
|
dst = sys.argv[2]
|
|
with open(src, encoding='utf-8') as f:
|
|
rows = json.load(f)
|
|
lines = []
|
|
for r in sorted(rows, key=lambda x: x.get('dates', '')):
|
|
lines.append('%-14s %-70s %s' % (r['id'], r.get('title', '')[:70], r.get('dates', '')[:38]))
|
|
with open(dst, 'w', encoding='utf-8') as f:
|
|
f.write('\n'.join(lines))
|
|
print('wrote', len(lines))
|