SyntaxFix
Write A Post
Hire A Developer
Questions
Try:
s = ''.join(filter(str.isalnum, s))
This will take every char from the string, keep only alphanumeric ones and build a string back from them.