December 2009
Beginner to intermediate
360 pages
11h 12m
English
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[0] 'H' >>> x[-1] 'o' >>> x[1:] ...
Read now
Unlock full access