MWE:
Code: Select all
import yaml
def yes_or_no(
word: str,
) -> dict:
thestring = {
"theword": word,
}
return thestring
thedict = yes_or_no("yes")
# Writing nested data to a YAML file
with open("output.yaml", "w") as file:
yaml.dump(thedict, file)
Code: Select all
theword: 'yes'
Code: Select all
theword: what
Mobile version