Replace '\xa0' in string with spaces

时间:2018-08-22 13:56:20

标签: python regex python-3.x

My string is 'MRK\xa0Software\xa0Services\xa0Private\xa0Limited' and I want to replace the hexadecimal part (\xa0) with spaces, such that I get

MRK Software Services Private Limited which I can further split into different words.

1 个答案:

答案 0 :(得分:1)

myString = "MRK\xa0Software\xa0Services\xa0Private\xa0Limited"

newString = myString.replace("\xa0", " ")

If you are getting unicode error you can try:

newString = myString.replace("\\xa0", " ")
相关问题