Skip to content

Instantly share code, notes, and snippets.

@billiepander
Created February 22, 2017 08:52
Show Gist options
  • Select an option

  • Save billiepander/1839a3bab83a0ae74ff5016d33498aed to your computer and use it in GitHub Desktop.

Select an option

Save billiepander/1839a3bab83a0ae74ff5016d33498aed to your computer and use it in GitHub Desktop.
同时去掉一段话的中英文标点
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