title: How do I properly use the sub function of regular expression in Python?
body: <p>So I have a number like <code>7.50x</code>, which I want to convert to <code>7.5x</code>. I thought about using regular expressions. I can easily match this expression, for example by using <code>re.search('[0-9].[0-9]0x', string)</code>. However, I'm confused how to replace every such number using the <code>re.sub</code> method. For example what should be there as the second argument?</p>
  
  <pre><code>re.sub('[0-9].[0-9]0x', ?, string)
  </code></pre>