title: How to select the following specific XML nodes using XPath?
body: <p>I have an XML doc like the following:</p>
  
  <pre><code>&lt;Objects&gt;
    &lt;object distName="a/b"&gt;  &lt;/object&gt;
    &lt;object distName="a/b/c1"&gt;  &lt;/object&gt;
    &lt;object distName="a/b/c4/d/e"&gt;  &lt;/object&gt;
    &lt;object distName="a/b/c2"&gt;  &lt;/object&gt;
    &lt;object distName="a/b/c6/d"&gt;  &lt;/object&gt;
  &lt;/Objects&gt;
  </code></pre>
  
  <p>And I need to select all nodes which has a path that ends with <strong>"c" + number</strong>. Like: "<em>a/b/c1</em>" and "<em>a/b/c2</em>" but not like "<em>a/b/c6/d</em>", nor "<em>a/b/c4/d/e</em>". </p>
  
  <p>If I try the following:</p>
  
  <pre><code>      `cNodes = xmlDoc.xpath("//object[contains(@path, `a/b/c`)]")`
  </code></pre>
  
  <p>Then this will include "a/b/c6/d" and "a/b/c4/d/e" which is not what I require. </p>
  
  <p>So is there a way to do the job <strong><em>in one or maybe two lines of code</em></strong>. I mean I can do it with like a loop and stuff like that, which I don't want to. That's because the real XML doc is thousands of nodes. </p>
  
  <p>PS: Python 2.7, lxml</p>