Replace one : String Replace « String « Python






Replace one

Replace one

S = 'xxxxSPAMxxxxSPAMxxxx'

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

           
       








Related examples in the same category

1.Replace allReplace all
2.String replacementString replacement
3.String replace DemoString replace Demo
4.String method: With a minor replacementString method: With a minor replacement