[CentralOH] Removing Punctuation

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Mon Jan 20 23:56:21 CET 2014


On Mon, 20 Jan 2014 16:09:56 -0500, jep200404 at columbus.rr.com wrote:

> [1] See http://colug.net/python/dojo/20140117/word-count-example-rev2.ipynb

      "for character in bunch_of_words:\n",
      "    if character in string.punctuation:\n",
      "        bunch_of_words = bunch_of_words.replace(character,\"\")\n",

can be simplified as .translate(None, string.punctuation)

as in http://colug.net/python/dojo/20140117/word-count-example-rev3.ipynb


More information about the CentralOH mailing list