> Let's suppose > s='12345 4343 454' > How can I replace the last '4' character? If the last '4' will not always be the last character in the string, you could do: 'X'.join(s.rsplit('4',1)) -Dave