Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 554 Bytes

File metadata and controls

17 lines (11 loc) · 554 Bytes

Clean Text

Define a function called clean_text() that takes in some text as a parameter.

  • remove all new line characters \n from the text
  • remove all punctuation from the text
  • convert the entire text to lowercase
  • use the .split() method to split the text at every space, creating a list of individual words

Finally, return the list of lower case words with no punctuation.

clean_text("How now, Brown Cow?")

output:
['how', 'now', 'brown', 'cow']