I am writing yaml file like this
with open(fname, "w") as f:
yaml.safe_dump({'allow':'', 'deny': ''}, f,
default_flow_style=False, width=50, indent=4)
This outputs:
allow: ''
I want to output as
allow:
How can I do that?
For None
type to be read from python use null
in yaml
A YAML file test.yml
like this
foo: null
bar: null
will be read by python as
import yaml
test = yaml.load(open('./test.yml'))
print(test)
foo: None
bar: None