help_tool.py 736 B

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