Last active
April 1, 2018 14:29
-
-
Save ripiuk/e94dfa70cb476f0cca7b4c3157dee719 to your computer and use it in GitHub Desktop.
Remove non-ASCII characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def _remove_non_ascii(text: str): | |
return ''.join(ch for ch in filter(lambda x: x in string.printable, text)) if isinstance(text, str) else text | |
_remove_non_ascii('¬äºé”æåº - 西éåº (å°åå¸) Wonstar - Ximen') # output: ' - () Wonstar - Ximen' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment