|
|
@ -0,0 +1,20 @@ |
|
|
|
# This script should be runned in the root directory of the ordinary web |
|
|
|
# This script will create contents.json and contents.txt in tmp/ |
|
|
|
# the only difference of them is the format. |
|
|
|
|
|
|
|
import json, os |
|
|
|
from app import * |
|
|
|
|
|
|
|
contents = Candidate.query.all() |
|
|
|
contents = list(map(lambda x: x.content, Candidate.query.all())) |
|
|
|
contents = list(map(lambda s: s.replace('/r', ''), contents)) |
|
|
|
|
|
|
|
os.makedirs('tmp/', exist_ok = True) |
|
|
|
|
|
|
|
with open('tmp/contents.json', 'w') as f: |
|
|
|
json.dump(contents, f) |
|
|
|
|
|
|
|
for i in range(len(contents)): |
|
|
|
contents[i] = 'No. ' + str(i + 1) + ':\n' + contents[i] |
|
|
|
with open('tmp/contents.txt', 'w') as f: |
|
|
|
f.write('\n\n\n\n'.join(contents)) |