Created
February 22, 2017 08:52
-
-
Save billiepander/1839a3bab83a0ae74ff5016d33498aed to your computer and use it in GitHub Desktop.
同时去掉一段话的中英文标点
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
| from zhon import hanzi # pip install zhon | |
| import string | |
| from itertools import chain | |
| a_string = a_string.translate( | |
| str.maketrans({key: None for key in chain(hanzi.punctuation, string.punctuation)}) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment