In this article, we would like to show you how to get the first character of a string in Python.
first_character = string
In this example, we get the first character of
"dirask" string by index.
In Python each character in a string has an index number associated with it. We can use the index to access any character.
string = "dirask" first_character = string print("First character is:",first_character)
First character is: d