How to accurately change a parsed version number in string form to numeric?
<p>So say I have a retrieved directory name, "LibX_00.03", and I retrieve the version information of the directory with:</p>

<pre class="lang-py prettyprint-override"><code>lib = "LibX_00.03"

version = lib[-5:]
</code></pre>

<p>After doing this I then want to compare this version number with others to assert the latest release of the library, the trouble with this being that is has to be in a numberic form for comparison and not a str.
Casting to int or float both do not work, as int will give a whole number, and float gives an innacurate conversion:</p>

<pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; float(version)
0.299999...
</code></pre>

<p>So how can I accurately preserve the version number while having it in a form where I make a comparison?</p>
