华清大学特普通奖学金初选报名系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
659 B

  1. # This script should be runned in the root directory of the ordinary web
  2. # This script will create contents.json and contents.txt in tmp/
  3. # the only difference of them is the format.
  4. import json, os
  5. from app import *
  6. contents = Candidate.query.all()
  7. contents = list(map(lambda x: x.content, Candidate.query.all()))
  8. contents = list(map(lambda s: s.replace('/r', ''), contents))
  9. os.makedirs('tmp/', exist_ok = True)
  10. with open('tmp/contents.json', 'w') as f:
  11. json.dump(contents, f)
  12. for i in range(len(contents)):
  13. contents[i] = 'No. ' + str(i + 1) + ':\n' + contents[i]
  14. with open('tmp/contents.txt', 'w') as f:
  15. f.write('\n\n\n\n'.join(contents))