I have some strings like this in Python: ' سلام دوستان;\xa0\xa0ج\xa0۲ \xa0ص\xa0۳۸۸ مى شود راهی پیدا کرد\u200c' How I can remove all \xa0 and \u200* characters from the strings?
Asked
Active
Viewed 65 times
-3
-
3`replace` method – Matiiss Jul 23 '22 at 20:56
-
Please provide enough code so others can better understand or reproduce the problem. – Community Jul 23 '22 at 21:19
1 Answers
0
You can use the replace
method , to replace those characters with empty string.
original_string = 'سلام دوستان;\xa0\xa0ج\xa0۲ \xa0ص\xa0۳۸۸ مى شود راهی پیدا کرد\u200c'
new_string = original_string.replace('\xa0','').replace('\u200','')

Flavio Adamo
- 404
- 2
- 7