I have a string with a bunch of non-ASCII characters and I would like to remove it. I used the following function in Python 3:
def removeNonAscii(s):
return "".join(filter(lambda x: ord(x)<128, s))
str1 = "Hi there!\xc2\xa0My\xc2\xa0name\xc2\xa0is\xc2\xa0Blue "
new = removeNonAscii(str1)
The new string becomes:
Hi there!MynameisBlue
Is it possible to get spaces between the string such that it is:
Hi there! My name is Blue