How to replace the last occurence of an expression in a string
<p>Is there a quick way in Python to replace strings by starting from the end? For example:</p>

<pre><code>&gt;&gt;&gt; def rreplace(old, new, occurence)
&gt;&gt;&gt;     ... # Code to replace the last occurences of old by new

&gt;&gt;&gt; '&lt;div&gt;&lt;div&gt;Hello&lt;/div&gt;&lt;/div&gt;'.rreplace('&lt;/div&gt;','&lt;/bad&gt;',1)
&gt;&gt;&gt; '&lt;div&gt;&lt;div&gt;Hello&lt;/div&gt;&lt;/bad&gt;'
</code></pre>
