mirror of
https://github.com/one-among-us/data.git
synced 2024-11-10 13:24:50 +08:00
[F] Generator: Mkdirs if not already exists
This commit is contained in:
parent
a6d8e7d531
commit
0d9198806f
@ -1,5 +1,6 @@
|
|||||||
import io
|
import io
|
||||||
import os, json5
|
import os, json5
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
output = []
|
output = []
|
||||||
@ -10,5 +11,6 @@ if __name__ == '__main__':
|
|||||||
o = json5.load(f)
|
o = json5.load(f)
|
||||||
output.append({'path': p, 'id': o['id'], 'name': o['name'], 'profileUrl': o['profileUrl']})
|
output.append({'path': p, 'id': o['id'], 'name': o['name'], 'profileUrl': o['profileUrl']})
|
||||||
|
|
||||||
|
Path("generated").mkdir(parents=True, exist_ok=True)
|
||||||
with io.open('generated/people-list.json5', 'w', encoding='utf-8') as f:
|
with io.open('generated/people-list.json5', 'w', encoding='utf-8') as f:
|
||||||
f.write(json5.dumps(output, indent=2, ensure_ascii=False))
|
f.write(json5.dumps(output, indent=2, ensure_ascii=False))
|
||||||
|
Loading…
Reference in New Issue
Block a user