I've learned python for a few months and I have a question.
Example I have a string s='string_123'
, I need to get "123"
from s.
As I know, python provided some ways:
This question look likely with: Python: Extract numbers from a string
But, it mostly compare split() with regex. I need to know for detail of each way.
s.split("_")[-1]
s.partition("_")[2]
s[7:]
So which way is the best above? Or do we have any way else better than all?