标签: python
我知道在Java中我可以使用String.replaceFirst(old, new)来替换“ old”的第一个实例,也可以使用String.replaceAll(old, new)来替换所有“ old”的实例。
String.replaceFirst(old, new)
String.replaceAll(old, new)
在Python中,我发现String.replace(old, new)将替换所有“ old”实例;我只想替换第一个。我将如何在Python中做String.replaceFirst(old, new)?
String.replace(old, new)