I saw this in other languages, but I can not find it for Python, maybe it has a specific name that I do not know about. I want to split the line after the last occurrence of the '-' character, my line will look like this:
POS
I want to take the last number from this line after the last - in this case 1462. I have no idea how to achieve this in order to achieve this when only one such character is expected, I would use the following:
last_number = last_number[last_number.index('-')+1:]
How could I achieve this when an unknown number can be present, and the final number can be of any length?
twigg source
share