Python: parse all files in a folder : <p>I am trying to parse allthe files in a folder with help of a python loop and then store it as a dataframe, I am using following script </p>

<pre><code>path='C:\\Users\\manusharma\\Training'

for filename in os.listdir(path):
    tree = ET.parse(filename)
    a = ET.tostring(tree.getroot(), encoding='utf-8', method='text')
    c = a.replace('\n', '')
    df = df.append({'text': c, 'type': 'abc'}, ignore_index=True)
</code></pre>

<p>and my path file has following files </p>

<pre><code>abc1.xml
abc2.xml
abc3.xml
abc4.xml
abc5.xml
</code></pre>

<p>every time, I ran my code it show me an error </p>

<pre><code>IOError: [Errno 2] No such file or directory: 'abc1'
</code></pre>

<p>though it is there, where am I making an error? Appreciate every help</p>
