Answers for "python regex get string before character"

1

python regex get string before character

You don't need regex for this

>>> s = "Username: How are you today?"
You can use the split method to split the string on the ':' character

>>> s.split(':')
['Username', ' How are you today?']
Posted by: Guest on May-16-2020

Code answers related to "python regex get string before character"

Python Answers by Framework

Browse Popular Code Answers by Language