How do split string by apostrophe '
and -
?
For example, given string = "pete - he's a boy"
You can use the regular expression module's split function:
re.split("['-]", "pete - he's a boy")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With