String Python

S = 'xxxxSPAMxxxxSPAMxxxx'
print S.replace('SPAM', 'EGGS')           # replace all