help_tool.py 708 B

123456789101112131415161718192021222324252627282930
  1. import re
  2. import json
  3. o_json = json.loads(open('en-US.json', encoding = 'utf8').read())
  4. print('n_name : ', end = '')
  5. n_name = input()
  6. n_json = json.loads(open(n_name + '.json', encoding = 'utf8').read())
  7. print()
  8. for i in list(n_json):
  9. if not i in o_json:
  10. del n_json[i]
  11. for i in list(o_json):
  12. if not re.search(r'^_', i[0]):
  13. if not i in n_json:
  14. print('o_title : ' + i)
  15. print('o_text : ' + o_json[i])
  16. print('n_text : ', end = '')
  17. n_text = input()
  18. n_json = {**n_json, **{i : n_text}}
  19. n_data = json.dumps(n_json, indent = 4, ensure_ascii = False)
  20. f = open(n_name + '.json', "w", encoding='utf8')
  21. f.write(n_data)
  22. f.close()