Answer the question
In order to leave comments, you need to log in
How to remove punctuation in python but leave some characters?
Hello.
How to remove punctuation in python, but leave some characters in a string?
The line, for example, is like this - "blah. ! blah (beeep?) heap :) :) :)
I remove characters like this print re.sub(r'[^\w\s]', '', text),
but how should I leave emoji at the end?
Answer the question
In order to leave comments, you need to log in
you want to remove non-alphabetic characters and leave non-alphabetic characters...
this is not done with one expression
or solve the problem in a direct pass in three stages
1) clearing non-unicode (you may not need a stage)
2
) clearing unnecessary
characters
three steps
1) replace emoticons with sequences
2) cleanup
3) replace sequences with emoticons
in three steps faster
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question