Chapter 12

Working with Strings

IN THIS CHAPTER

check Considering the string difference

check Working with special and single characters

check Manipulating and searching strings

check Modifying the appearance of string output

Your computer doesn’t understand strings. It’s a basic fact. Computers understand numbers, not letters. When you see a string on the computer screen, the computer actually sees a series of numbers. However, humans understand strings quite well, so applications need to be able to work with them. Fortunately, Python makes working with strings relatively easy. It translates the string you understand into the numbers the computer understands, and vice versa.

To make strings useful, you need to be able to manipulate them. Of course, that means taking strings apart and using just the pieces you need or searching the string for specific information. This chapter describes how you can build strings by using Python, dissect them as needed, and use just the parts you want after you find what’s required. String manipulation is an important part of applications because humans depend on computers ...

Get Beginning Programming with Python For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.