Ajout/upgrade des arts obscurs
This commit is contained in:
19
srcdata/normalize.py
Normal file
19
srcdata/normalize.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
|
||||
FIELDS = ["name", "competence", "description", "duree", "portee", "concentration", "critique", "ingredients", "resistance"]
|
||||
|
||||
def capitalize_first_letter(s):
|
||||
if isinstance(s, str) and s:
|
||||
return s[0].upper() + s[1:]
|
||||
return s
|
||||
|
||||
with open("../srcdata/sort_magieduclan.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
for spell in data:
|
||||
for field in FIELDS:
|
||||
if field in spell:
|
||||
spell[field] = capitalize_first_letter(spell[field])
|
||||
|
||||
with open("../srcdata/sort_magieduclan.json", "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
Reference in New Issue
Block a user