title: how to retrieve specific tag information using ElementTree?
body: <p>I would like to retrieve specific tag attribute.
  <code>file</code> tag contains child tag <code>filename</code> and basing on this field I would like to decide if the <code>modification</code> should be taken.</p>
  <p>In other words: if <code>filename</code> value contains <code>.tar</code> I would like to print modification time.</p>
  <p>In example below I'd expect that <code>2020-07-15T06:41:12.000Z</code> would be printed.</p>
  <p>I was trying to do this for 2 hours but I did not succed, so I'll be really thankful for any tips bringing me closer to the solution.
  Here is the code, but nothing is printed nor added to <code>dates</code> list:</p>
  <pre><code>import xml.etree.ElementTree as ET
  
  tree = ET.parse(r&quot;C:\path\to\file\logs.xml&quot;)
  root = tree.getroot()
  dates = []
  for filetag in root.findall('.//{*}file'):
      for filename in filetag.findall('../{*}filename'):
          if &quot;.tar&quot; in filename.attrib['value']:
              print(filename)
              dates.append(filename)
  </code></pre>
  <p>Here is XML document:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;session xmlns=&quot;http://winscp.net/schema/session/1.0&quot; name=&quot;user@11.11.111.11&quot; start=&quot;2020-07-22T10:01:12.939Z&quot;&gt;
    &lt;ls&gt;
      &lt;destination value=&quot;/folder/processing&quot; /&gt;
      &lt;files&gt;
        &lt;file&gt;
          &lt;filename value=&quot;.&quot; /&gt;
          &lt;type value=&quot;d&quot; /&gt;
          &lt;modification value=&quot;2020-07-22T08:57:28.000Z&quot; /&gt;
          &lt;permissions value=&quot;rwxrwsrwx&quot; /&gt;
          &lt;owner value=&quot;1000130000&quot; /&gt;
          &lt;group value=&quot;0&quot; /&gt;
        &lt;/file&gt;
        &lt;file&gt;
          &lt;filename value=&quot;..&quot; /&gt;
          &lt;type value=&quot;d&quot; /&gt;
          &lt;modification value=&quot;2020-07-22T08:51:15.000Z&quot; /&gt;
          &lt;permissions value=&quot;rwxrwxrwx&quot; /&gt;
          &lt;owner value=&quot;1000130000&quot; /&gt;
          &lt;group value=&quot;0&quot; /&gt;
        &lt;/file&gt;
        &lt;file&gt;
          &lt;filename value=&quot;package_tsp200715092001_20200715074120.tar&quot; /&gt;
          &lt;type value=&quot;-&quot; /&gt;
          &lt;size value=&quot;4014536192&quot; /&gt;
          &lt;modification value=&quot;2020-07-15T06:41:12.000Z&quot; /&gt;
          &lt;permissions value=&quot;rw-rw-rw-&quot; /&gt;
          &lt;owner value=&quot;1005&quot; /&gt;
          &lt;group value=&quot;1005&quot; /&gt;
        &lt;/file&gt;
        &lt;file&gt;
          &lt;filename value=&quot;package_tsp200715092001_20200715074120&quot; /&gt;
          &lt;type value=&quot;d&quot; /&gt;
          &lt;modification value=&quot;2020-07-15T06:41:59.000Z&quot; /&gt;
          &lt;permissions value=&quot;rwxr-Sr--&quot; /&gt;
          &lt;owner value=&quot;1000130000&quot; /&gt;
          &lt;group value=&quot;0&quot; /&gt;
        &lt;/file&gt;
      &lt;/files&gt;
      &lt;result success=&quot;true&quot; /&gt;
    &lt;/ls&gt;
  &lt;/session&gt;
  </code></pre>