+ 1
Does anyone know the problem with this code? It's supposed to replace the Agent names with (Initial)****.
import re agentRegex = re.compile(r'Agent (/w)/w*') mo = agentRegex.sub(r'\1****', 'Agent Alice knew that Agent Bob told Agent Carol that Agent Eve was a double agent.') print(mo)
3 Answers
+ 1
re is what you import to use regexes (short for regular expressions). It's part of the lessons in the app.
0
sorry but I got a question too, can someone explain what is re đ ?
0
Wait i fixed it. Its \w, not /w