例如:
“是的......我是亚伦”
答案 0 :(得分:15)
"yes...I am Aaron".replace("...", "")
答案 1 :(得分:1)
>>> 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
>>>
答案 2 :(得分:0)
jamylak的答案应该可以解决问题,但是,如果您使用的是ASCII省略号,请尝试以下操作:
>>> s = 'yes\u2026 I am Aaron'
>>> s
'yes… I am Aaron'
>>> s.replace('\u2026', '')
'yes I am Aaron'
>>>