我在 Python 中有一些这样的字符串:' سلام دوستان;\\xa0\\xa0ج\\xa0۲ \\xa0ص\\xa0۳۸۸ مى شود راهی پیدا کرد\' 如何从字符串中删除所有 \\xa0 和 \\u200* 字符?<\/p>"]
You can use the replace<\/code> method , to replace those characters with empty string.<\/i>
original_string = 'سلام دوستان;\xa0\xa0ج\xa0۲ \xa0ص\xa0۳۸۸ مى شود راهی پیدا کرد\u200c'
new_string = original_string.replace('\xa0','').replace('\u200','')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.