last two characters of a string in Python
last two characters of a string in Python
it’s very simple to get last two character of any string. it can be done by fetch from last two characters of string, with the help of example it can be understand very easily-
- x="abcefgh"
- print(x[len(x)-2:])
Comments
Post a Comment