s = "Bob hit a ball!, the hit BALL flew far after it was hit."
Run Code Online (Sandbox Code Playgroud)
我需要从 s 中删除以下字符
!?',;.
Run Code Online (Sandbox Code Playgroud)
如何使用 re.sub 来实现这一点?
re.sub(r"!|\?|'|,|;|."," ",s) #doesn't work. And replaces all characters with space
Run Code Online (Sandbox Code Playgroud)
有人能告诉我这有什么问题吗?