Real Python50 min readtutorialintro
Strings and Character Data in Python
Summary
Python strings are immutable sequences of characters. This tutorial covers creating strings with literals and str(), using escape sequences, indexing, slicing, concatenation, and interpolation via f-strings or format().
- Single or double quotes create string literals; triple quotes are used for multiline strings and docstrings.
- Strings are immutable—any modification returns a new string object.
- Escape sequences (e.g., \', \" , \\) let you include special characters inside literals.
- Indexing (s[0]) and slicing (s[start:end]) provide direct access to characters and substrings.
Any Python developer who works with textual data should know the basics of string literals, immutability, and common manipulation techniques.
5/10




