How to get Last Character in Python String?

Опубликовано: 20 Февраль 2026
на канале: ProgramGuru
493
6

To get the last character in the string in Python, we can use "string indexing" using square brackets.

x[len(x) - 1] or x[-1]

This expression returns the last character in the string.

References
=========
Python tutorial to get the last character in the string
https://www.tutorialkart.com/python/p...

Python tutorials
https://www.tutorialkart.com/python/