I have a string with two "-"
467.2-123-hdxdlfow
I want to remove everything after the second "-" so that I get "467.2-123". What is the best way to do this?
before, sep, after = theString.rpartition("-")
This splits the str about the last occurrence of "-" and your answer would be the variable before
.
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