Tracy Ann Monteiro Tracy Ann Monteiro - 1 year ago 89
Python Question

How do I write my xml output to a file

I currently have a Python script that does a get request and prints out the data which is in xml format. How do I dump this output to a xml file for parsing?

Answer Source

Assuming you have a string variable containing the xml data, you can do the following:

with open("output.xml", "w") as f:
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download