Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get end of string python

a = "abcde"
lastChar = a[-1]
print(f'Using index, lastChar is {lastChar} , using slice last char = { a[len(a)-1::] } = { a[len(a)-1] } = { a[:-2:-1] }') 
'''
output
Using index, lastChar is e , using slice last char = e 
'''
 
PREVIOUS NEXT
Tagged: #string #python
ADD COMMENT
Topic
Name
3+6 =