python:extract certain part of string
<p>I have a string from which I would like to extract certain part. The string looks like :</p>

<pre><code> E:/test/my_code/content/dir/disp_temp_2.hgx
</code></pre>

<p>This is a path on a machine for a specific file with extension hgx</p>

<p>I would exactly like to capture "disp_temp_2". The problem is that I used strip function, does not work for me correctly as there are many '/'. Another problem is that, that the above location will change always on the computer.</p>

<p>Is there any method so that I can capture the exact string between the last '/' and '.'</p>

<p>My code looks like:</p>

<pre><code>path = path.split('.')
</code></pre>

<p>.. now I cannot split based on the last '/'. </p>

<p>Any ideas how to do this?</p>

<p>Thanks</p>
