Tracy Ann Monteiro Tracy Ann Monteiro - 7 months ago 55
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?


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

with open("output.xml", "w") as f: