I am reading XML using Python and writing CSV. One of XML element has New Line along with the data. So, When I write the CSV new line comes in between data. I am trying different methods to remove new line while reading XML.
for demo in root.iter("CustDemo"):
dob_imputation = demo.find("dob_imputation").text.replace("\n","")
Getting below error:
dob_imputation = demo.find("dob_imputation").text.replace("\n","")
AttributeError: 'NoneType' object has no attribute 'replace'
dob_imputation is a XML element and I am trying to store it in a variable without new line.