我有这样的事情:
text = 'This text is very very long.' replace_words = ['very','word'] for word in replace_words: text = text.replace('very','not very')
我想只替换第一个'非常'或选择哪个'非常'被覆盖.我在更大量的文本上这样做,所以我想控制重复单词的替换方式.
python string replace
python ×1
replace ×1
string ×1