MWE:
Код: Выделить всё
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)
Код: Выделить всё
theword: 'yes'
Код: Выделить всё
theword: what
Подробнее здесь: https://stackoverflow.com/questions/798 ... t-shouldnt
Мобильная версия