SyntaxFix
Write A Post
Hire A Developer
Questions
Just use the split function. It returns a list, so you can keep the first element:
split
>>> s1.split(':') ['Username', ' How are you today?'] >>> s1.split(':')[0] 'Username'