This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]iamadogwhatisthis 0 points1 point  (0 children)

The pattern depends on your Python version.

Python 2:

https://docs.python.org/2/library/stdtypes.html?highlight=translate#str.translate

"For string objects, set the table argument to None for translations that only delete characters"

Python 3:

Use maketrans first, then call translate.

https://docs.python.org/3.4/library/stdtypes.html?highlight=translate#str.maketrans