Mega Code Archive

 
Categories / Python / String
 

Replace one

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