0

Is there any simple function, such as .replace("", " "), that removes non alphanumeric characters? I want to,for example, remove "-" or other kinds of non alphanumeric characters from an input.

  • Possible duplicate of [Stripping everything but alphanumeric chars from a string in Python](http://stackoverflow.com/questions/1276764/stripping-everything-but-alphanumeric-chars-from-a-string-in-python) – tzaman Nov 29 '16 at 16:16
  • Possible duplicate of [Python, remove all non-alphabet chars from string](http://stackoverflow.com/questions/22520932/python-remove-all-non-alphabet-chars-from-string) – Dragos Nov 29 '16 at 16:19
  • one simple solution would be this: [filter isalnum](http://stackoverflow.com/a/27773789/2162347) – Dragos Nov 29 '16 at 16:21
  • does it work for int, because the input is going to be a phone number, and i want tor remove "-" for example if the user writes 055-56753 @Dragos – michael Mekonnen Nov 29 '16 at 16:23
  • @michaelMekonnen you can check for yourself here: [Python Manual](https://docs.python.org/2.7/library/stdtypes.html?highlight=isalnum#str.isalnum) – Dragos Nov 29 '16 at 16:38

0 Answers0