title: How to replace the some characters from the end of a string?
body: <p>I want to replace characters at the end of a python string.  I have this string:</p>
  
  <pre><code> s = "123123"
  </code></pre>
  
  <p>I want to replace the last <code>2</code> with <code>x</code>.  Suppose there is a method called <code>replace_last</code>:</p>
  
  <pre><code> r = replace_last(s, '2', 'x')
   print r
   1231x3
  </code></pre>
  
  <p>Is there any built-in or easy method to do this?</p>