title: How to mapping XML tag by matching the tag with a string using Python?
body: <p>I have an XML file.</p>
  <p>Here is the content:</p>
  <pre><code>&lt;Country&gt;
       &lt;number no=&quot;2008&quot; info=&quot;update&quot;&gt;
            &lt;detail name=&quot;man1&quot; class=&quot;A1&quot;&gt;
                 &lt;string name=&quot;ruth&quot; /&gt;
                 &lt;string name=&quot;amy&quot; /&gt;
            &lt;/detail&gt;
            &lt;detail name=&quot;man2&quot; class=&quot;A2&quot;&gt;
                 &lt;string name=&quot;lisa&quot; /&gt;
                 &lt;string name=&quot;graham&quot; /&gt;
            &lt;/detail&gt;
       &lt;/number&gt;
       &lt;number no=&quot;2006&quot; info=&quot;update&quot;&gt;
            &lt;detail name=&quot;woman1&quot; class=&quot;B1&quot;&gt;
                 &lt;string name=&quot;grace&quot; /&gt;
                 &lt;string name=&quot;chil&quot; /&gt;
            &lt;/detail&gt;
            &lt;detail name=&quot;woman2&quot; class=&quot;B2&quot;&gt;
                 &lt;string name=&quot;emy&quot; /&gt;
                 &lt;string name=&quot;toms&quot; /&gt;
            &lt;/detail&gt;
       &lt;/number&gt;
  &lt;/Country&gt;
  </code></pre>
  <p>I need to get the value of number in here <code>&lt;number no=&quot;2008&quot;</code> by mapping with this value <code>class=&quot;A1&quot;</code></p>
  <p>I tried this way, but It print <code>None</code>.
  here is the code:</p>
  <pre><code>import xml.etree.ElementTree as ET
  ReadXML = ET.parse('data.xml')
  stringno = 'A1'
  for family in ReadXML.findall('./number/detail[@class=&quot;{}&quot;]'.format(stringno)):
      name = family.get('no')
      print(name)
  </code></pre>
  <p>Anyone can help me, please. Thanks a lot</p>