title: Replace only the ending of a string
body: <p>It irks me not to be able to do the following in a single line. I've a feeling that it can be done through list comprehension, but how?</p>
  
  <pre><code>given_string = "first.second.third.None"
  string_splitted = given_string.split('.')
  string_splitted[-1] = "fourth"
  given_string = ".".join(string_splitted)
  </code></pre>
  
  <p>Please note that the number of dots (.) in the given_string is constant (3). So i always want to replace the fourth fragment of the string.</p>