Answer the question
In order to leave comments, you need to log in
Is it possible to set a specific amount of replacement for re.sub?
This code replaces all suitable ones, is it possible to set a condition under which such an amount will be replaced as I write?
Given two lines. Delete the first occurrence of the second string in the first line
import re
a = 'asdasddasdcx'
b = 'as'
a = re.sub(b, '', a)
print(a)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question