Answers for "pick last 3 digit of string in python"

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

get last n characters of string python

last_n_chars = -4
mystr = "abcdefghijkl"
mystr[last_n_chars:]
# 'ijkl'
Posted by: Guest on January-22-2022

Code answers related to "pick last 3 digit of string in python"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language