I'm writing a program that compresses text by replicating it with a sequence of numbers - but I don't know how to get the program to recognise punctuation as a separate item in the list.
eg, in this sentence with a comma, the comma means that the words 'comma,'
and 'comma'
are different when using split()
. I want to have 'comma' ',' 'comma'
instead.
I don't want to get rid of the punctuation - i want it as a separate item in a list