merge heritages.yaml to ancestries.yaml -> ancestriesheritages.yaml

This commit is contained in:
jrmiller82 committed 2020-04-20 21:17:43 -05:00
1 parent 296b4ef556
commit 58ecb056ce
2 files changed
+366

No files matched your search

+31
View File
@@ -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()