awacke1's picture
Duplicate from awacke1/Knowledge-graphs
7eca486
raw
history blame contribute delete
212 Bytes
def clip_text(t, lenght = 4):
t_sub = t.replace("...", "dotdotdot")
t_clipped = ".".join(t_sub.split(".")[:lenght]) + "."
t_reverted = t_clipped.replace("dotdotdot", "...")
return t_reverted