This chapter covers
Handling text—from user input, to filenames, to processing chunks of text—is a common chore in programming. Python comes with powerful tools to handle and format text. This chapter discusses the standard string and string-related operations in Python.
For the purposes of extracting characters and substrings, strings can be considered sequences of characters, which means you can use index or slice notation:
>>> x = "Hello">>> x'H'>>> x[-1]'o'>>> x[1:]'ello'