get last 4 digits of string in python code example
Example: how to select last 2 elements in a string python
>>>mystr = "abcdefghijkl"
>>>mystr[-4:]
'ijkl'
>>>mystr[:-4] #to select all but last 4 characters
'abcdefgh'
>>>mystr = "abcdefghijkl"
>>>mystr[-4:]
'ijkl'
>>>mystr[:-4] #to select all but last 4 characters
'abcdefgh'