1# string replace() function perfectly solves this problem:
2
3# string.replace(s, old, new[, maxreplace])
4
5# Return a copy of string s with all occurrences of substring old replaced
6# by new. If the optional argument maxreplace is given, the first maxreplace
7# occurrences are replaced.
8
9>>> u'longlongTESTstringTEST'.replace('TEST', '?', 1)
10u'longlong?stringTEST'