I can't put spaces in-between the words and prevent it from printing three times.
6/10/2020 9:12:18 PM
Maybe just add a condition for i==' ' apart from it being isalnum(). Then it won't get cleared and so you won't need to add it again later on.
check for spaces as well
res_str=[i for i in str if i.isalnum() or i==" "]
Chinyere [Inactive] Try:
"([a-zA-Z0-9 ]*)" note there is a space after the 9
Just add break at the bottom-most part of the for loop
Send us a message