例如:
“是的……我是亚伦”
"yes...I am Aaron".replace("...", "")
jamylak 的答案应该可以解决问题,但是,如果您使用的是 ASCII 省略号,请尝试以下操作:
>>> s = 'yes\u2026 I am Aaron'
>>> s
'yes… I am Aaron'
>>> s.replace('\u2026', '')
'yes I am Aaron'
>>>
>>> import re
>>> s = "1,2,3,... ,10"
>>> s = re.sub("\.\.\.", "", s)
>>> s
'1,2,3, ,10'
>>> import re
>>> print re.sub("[\.][\.][\.]", " ", "yes...I am Aaron")
yes I am Aaron
>>> print re.sub("[\.]"*3, " ", "yes...I am Aaron")
yes I am Aaron
>>> print re.sub("[\b\.\b]{3}", " ", "yes...I am Aaron")
yes I am Aaron
>>>