是否有类似于str.replace的方法可以执行以下操作:
>> replace(sequence=[0,1,3], old=[0,1], new=[1,2]) [1,2,3]
它应该像str.replace一样:用另一个序列替换序列的"片段",而不是用"new"的元素映射"old"的元素.谢谢 :)
python string sequence str-replace python-3.x
python ×1
python-3.x ×1
sequence ×1
str-replace ×1
string ×1