0
I am not able to understand why I am getting the output like this for the second print statement. Could u pls help me out
import re print(re.sub(r'AB?', '*', 'ABBBCD')) # OUTPUT - *BBCD print(re.sub(r'AB??', '*', 'ABBBCD')) # OUTPUT - *BBBCD
3 ответов
0
Which Output do you expect then or what should come out?
0
Felix Alcor I am asking for the reason or explanation as to why I am getting that output.
0
Seems like Double '??' only take the first char and not the second.
Here some Testing I have done.
https://code.sololearn.com/c7pDd7kOM2I1/?ref=app