Answers for "python from 2 to last"

15

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'
Posted by: Guest on July-09-2020
0

last 2 numbers of integer in python

int(str(num)[-2:])
Posted by: Guest on December-27-2021

Code answers related to "python from 2 to last"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language