mirror of
https://gitlab.com/jrmiller82/pathfinder-2-sqlite.git
synced 2026-10-12 22:29:44 -04:00
merge heritages.yaml to ancestries.yaml -> ancestriesheritages.yaml
This commit is contained in:
1 parent
296b4ef556
commit
58ecb056ce
2 files changed
+366
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import yaml
|
||||
import pprint
|
||||
|
||||
def main():
|
||||
|
||||
with open('ancestries.yaml') as anc:
|
||||
anc_data = yaml.full_load(anc)
|
||||
with open('heritages.yaml') as her:
|
||||
her_data = yaml.full_load(her)
|
||||
|
||||
print(anc_data)
|
||||
print(her_data)
|
||||
|
||||
for i in anc_data['ancestries']:
|
||||
i['heritages'] = []
|
||||
for j in her_data:
|
||||
print(j)
|
||||
if i['name'] in j['name']:
|
||||
i['heritages'].append(j)
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=1)
|
||||
|
||||
pp.pprint(anc_data)
|
||||
|
||||
final = yaml.safe_dump(anc_data, allow_unicode=True)
|
||||
with open('tmp-ancestriesheritages.yaml', 'w') as f:
|
||||
f.write(final)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user