Skip to content

Instantly share code, notes, and snippets.

@rrggrr
Created December 9, 2016 16:08
Show Gist options
  • Save rrggrr/017ec737f8d080d8e84689547aba9b0c to your computer and use it in GitHub Desktop.
Save rrggrr/017ec737f8d080d8e84689547aba9b0c to your computer and use it in GitHub Desktop.
def cleanText(text):
exclude = [")","(",'.','-',':','"',"'",",","&","$",u'"',u"'",";",u"&","`","’"]
#dd = {ord(c):None for c in badchars}
#tx = text.translate(dd)
#tx = text.translate(string.punctuation)
#print(text)
text = ''.join(ch for ch in text if ch not in exclude)
text = str(text)
return text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment