I came across some strings with the following content, eg:
"++++++//texto+++!!!+++//texto++++"
I'm trying to find a method to clear the sentence but I'm not getting success, could anyone help me?
I came across some strings with the following content, eg:
"++++++//texto+++!!!+++//texto++++"
I'm trying to find a method to clear the sentence but I'm not getting success, could anyone help me?
You can use Regex (Regular Expressions) to find such words, here is a short example:
import re
test1 = "31teste123 regex==="
test2 = "++++//jamanta+++de+++//pedra++++"
def formatString(string):
formatedArray = re.findall('[a-zA-Z]+', string)
print(" ".join(formatedArray))
formatString(test1)
formatString(test2)
The output would be an array containing the words:
test1 = ['test', 'regex']
test2 = ['manta', 'de', 'stone']
You can try more things on this site: link