如何刪除python中的特定字符後的所有字符？

I have a string. How do I remove all text after a certain character? (In this case ...)
The text after will ... change so I that's why I want to remove all characters after a certain one.

最佳答案

sep = '...'
rest = text.split(sep, 1)[0]