regex - re.sub() ellipsis in Python 3 -
i need simple solution, it's evading me. passing list of strings loop cleaning up, , need remove instance of ellipsis. here's example of i've tried:
text_list = ["string1", "string2", "string3...", "string.4"] in range(len(text_list)): text_list[i] = re.sub("\.", "", text_list[i]) text_list[i] = re.sub("\.{3}", "", text_list[i]) text_list[i] = re.sub("\.\.\.", "", text_list[i])
naturally, none of these removes ellipsis. period removed, though. output be:
for text in text_list: print(text) >>>string1 string2 string3... <- 1 didn't change string4 <- 1 did
i've exhausted regex documentation , google searches. how match ellipsis regex?
@swalladge had right notion here: use unicode. here answer.
"if want remove actual ellipsis, in unicode horizontal ellipsis character (…), need use in code, since 3 periods won't match it." –@swalladge
@rickdenhaan had easier way accomplish task. thanks!
Comments
Post a Comment