Python Strings Are Arrays
Strings are Arrays
Like many other popular programming languages, strings in Python are arrays of bytes representing unicode characters.
However, Python does not have a character data type, a single character is simply a string with a length of 1.
Square brackets can be used to access elements of the string.
Example
Get the character at position 1 (remember that the first character has the position 0):
a = "Hello, World!"
print(a[1])
Try it Yourself »
print(a[1])
Related Pages
Python Strings Tutorial String Literals Assigning a String to a Variable Multiline Strings Slicing a String Negative Indexing on a String String Length Check In String Format String Escape Characters