I have something like this:
text = 'This text is very very long.'
replace_words = ['very','word']
for word in replace_words:
text = text.replace('very','not very')
I would like to only replace the first 'very' or choose which 'very' gets overwritten. I'm doing this on much larger amounts of text so I want to control how duplicate words are being replaced.
The third parameter is the maximum number of occurrences that you want to replace.
From the documentation for Python:
From http://docs.python.org/release/2.5.2/lib/string-methods.html :
I didn't try but I believe it works