Skip to content

Instantly share code, notes, and snippets.

@omsobliga
Last active November 16, 2017 03:28
Show Gist options
  • Save omsobliga/23a782cd60ec6530c286415295f50e98 to your computer and use it in GitHub Desktop.
Save omsobliga/23a782cd60ec6530c286415295f50e98 to your computer and use it in GitHub Desktop.
import re
# 去除所有半角全角符号,只留字母、数字、中文。
def remove_punctuation(line):
rule = re.compile(ur'[^a-zA-Z0-9\u4e00-\u9fa5]')
line = rule.sub('',line)
return line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment