title: parse xml file and output to text file
body: <p>Trying to parse an xml file (config.xml) with ElementTree and output to a text file.  I looked at other similar ques here but none helped me. Using Python 2.7.9</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  tree = ET.parse('config.xml')
  notags = ET.tostring(tree,encoding='us-ascii',method='text')
  print(notags)
  </code></pre>
  
  <p>OUTPUT</p>
  
  <pre><code>Traceback (most recent call last):
  File "./python_element", line 9, in &lt;module&gt;
  notags = ET.tostring(tree,encoding='us-ascii',method='text')
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1126, in      tostring
  ElementTree(element).write(file, encoding, method=method
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 814, in write
  _serialize_text(write, self._root, encoding)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1005, in   _serialize_text
  for part in elem.itertext():
  AttributeError: 
  
  &gt; 'ElementTree' object has no attribute 'itertext'
  </code></pre>