I have a yaml doc as follows.
doc="""
... network-interface: >
... auto $(intf)
... iface $(intf) inet static
... address $(addr)
... network $(net)
... netmask $(mask)
... """
I am loading this doc and getting a python dict. I am trying to convert this doc back to my original doc and I am getting '\n
' characters.
ydict = yaml.load(doc)
ndoc = yaml.dump(ydict)
print ndoc
{network-interface: "auto $(intf)\n iface $(intf) inet static\n address $(addr)\n\
\ network $(net)\n netmask $(mask)\n"}
print yaml.dump(ydict, default_flow_style=False)
network-interface: "auto $(intf)\n iface $(intf) inet static\n address $(addr)\n\
\ network $(net)\n netmask $(mask)\n"
How do I get the original doc back without the '\n
'.