Are Python strings UTF-8? What is the complexity of s[n]?
![Are Python strings UTF-8? What is the complexity of s[n]?](https://ikriv.com/blog/wp-content/uploads/2025/03/string_encoding_comparison.png)
TL;DR Internally CPython stores strings with fixed character size of 1, 2, or 4 bytes, depending on the string [PEP-393]. The indexing operator s[n] takes constant time. UTF-8 representation can […]