Since the earliest days of computing, data used in computations was stored in basic text files. Anyone who has written shell scripts knows all too well that Unix systems and their utilities are built around the assumption that processing text will be much of the work of the program. Python is no different; it provides several programming elements to help with basic text processing tasks.
To begin, let’s note how Python stores strings. Strings are immutable lists, so they cannot be changed. Any change to a string’s contents requires making copies to new locations in memory. You must always keep ...