What Python data type is used to represent a sequence of characters?

The story behind the answer

The Python data type used to represent a sequence of characters is `str`. In Python, a string is an immutable sequence of Unicode characters, so it can store text such as names, sentences, symbols, and characters from many writing systems.

The name `str` is short for “string” and is also the built-in type name and constructor. You can create one with quotation marks, such as `str('hello')`, although ordinary literals like `'hello'` or `"hello"` are more common. Python does not have a separate built-in `char` type for a single character; a one-character string is still an instance of `str`.

A common mix-up is confusing the type name with informal descriptions. “Text” and “string” describe the kind of data, but `str` is Python’s canonical type name. Python 3 strings represent Unicode text, while raw binary data belongs in the `bytes` type. Strings support indexing, slicing, concatenation, formatting, and many methods such as `split()` and `replace()`.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: