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?
given_string = "first.second.third.None"
string_splitted = given_string.split('.')
string_splitted[-1] = "fourth"
given_string = ".".join(string_splitted)
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.