modified script to make a yaml file with the true matches

bradl/monsters-adult-gold-dragon
James R Miller 2019-11-30 12:34:48 -06:00
parent 7ccc6efb28
commit 2b9a7a3530
2 changed files with 1563 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import csv
import yaml import yaml
def main(): def main():
print("Running main")
# Load the CSV file and print out the false ones that need to be updated # Load the CSV file and print out the false ones that need to be updated
csvlist = [] csvlist = []
with open('../../scripts/feat_level.csv') as csvfile: with open('../../scripts/feat_level.csv') as csvfile:
@ -13,11 +12,22 @@ def main():
for row in reader: for row in reader:
if row['match'] == "False": if row['match'] == "False":
csvlist.append(dict(row)) csvlist.append(dict(row))
#print(csvlist)
res = yaml.safe_dump(csvlist, allow_unicode=True, width=100000) res = yaml.safe_dump(csvlist, allow_unicode=True, width=100000)
with open('feats-levels-false-matches.yaml', 'w') as f: with open('feats-levels-false-matches.yaml', 'w') as f:
f.write(res) f.write(res)
#print(res)
# Load the CSV file and make YAML file for the matched ones
truelist = []
with open('../../scripts/feat_level.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if row['match'] == "True":
tmp = {'name': row['name'], 'level': row['level']}
truelist.append(tmp)
trueres = yaml.safe_dump(truelist, allow_unicode=True, width=100000)
with open('feats-levels-true-matches.yaml', 'w') as f:
f.write(trueres)
# read the lines with true # read the lines with true
# #

File diff suppressed because it is too large Load Diff