0
why it gives error when adding max argument to sub function
import re str = "My name is David. Hi David." pattern = r"David" # max argument causes error,why??? newstr = re.sub(pattern, "Amy", str,max=0) print(newstr)
3 Answers
+ 2
where is max declaration and which is the error?
+ 1
did you try declaring it outside?
0
in the newstr var
when i delete it the code works fine
but the code above gives error why