" in htmlString:
last_p_index = htmlString.rfind("")
if last_p_index != -1:
htmlString = htmlString[:last_p_index + 4]
# Convert back to BeautifulSoup object
spell_paragraphs = htmlString
# add all attributes to a spell dictionnary
spellz[spell_name] = {
'school': spell_school,
'level': spell_level,
'casting_time': spell_castTime,
'components': spell_components,
'range': spell_range,
'target': spell_target,
'duration': spell_duration,
'saving_throw': spell_saving_throw,
'spell_resistance': spell_resistance,
'area': spell_area,
'effect': spell_effect,
'description': spell_paragraphs
}
with open('outputs/spells.yaml', 'w') as f:
yaml.dump(spellz, f)
# pbar.close()