card_process.py 534 B

123456789101112131415
  1. import json
  2. j = json.load(open("./mtg.json"))
  3. for setname in j['data'].keys():
  4. cardset = j['data'][setname]
  5. for card in cardset['cards']:
  6. if 'foreignData' in card.keys():
  7. for fd in card['foreignData']:
  8. if fd['language'] == 'Chinese Simplified':
  9. print(card['name'])
  10. print(fd['name'])
  11. if 'text' in fd.keys():
  12. print(fd['text'].replace('\n', '\x01'))
  13. else:
  14. print()