Winning Jeopardy function to normalize questions and answers

Screen Link:

Can anyone tell me,please, why str.replace() doesn’t working:

My Code:

text = 'A, bbbgdd:3jj ' 
text = text.replace("\W",'')

What I expected to happen:
text == 'A bbbgdd3jj ’

What actually happened:
text == 'A, bbbgdd:3jj ’


Heya! Looks like you’re trying to use regex as a pattern in the standard str.replace() function — this is only supported in pandas’ vectorized str.replace() method. You would need to import the re module if you’re planning on using regex to replace characters in a regular string:

Thank you for your answer!
It looks like you are right, I need to use the function re.sub() instead of str.replace() in case of using regex.