SyntaxFix
Write A Post
Hire A Developer
Questions
You can use the re module:
import re re.sub(r'\D', '', '+123-456-7890')
This will replace all non-digits with ''.