Using Python 3.x, I need to split a sentence up into individual words and punctuation.
e.g.\ "This is a sentence."
split up into
["This", "is", "a", "sentence", "."]
I'm trying to match words using a for loop, however if I try to match the word "sentence" it doesn't match because when I .split() on whitespace it makes it "sentence." instead of "sentence" and won't match because of the punctuation. What would be the best way to go about doing this?