Swipe to navigate through the chapters of this book
You’ve seen strings before and know how to make them. You’ve also looked at how to access their individual characters by indexing and slicing. In this chapter, you see how to use them to format other values (for printing, for example) and take a quick look at the useful things you can do with string methods, such as splitting, joining, searching, and more.
Please log in to get access to this content
To get access to this content you need the following product:
And if you want a locale-dependent thousands separator, you should use the n type instead.
For a more thorough description of the module, check out Section 6.1 of the Python Library Reference ( https://docs.python.org/3/library/string.html ).
You could also supply a dictionary, which you’ll learn about in the next chapter, mapping characters to other characters, or to None, if they are to be deleted.
- Working with Strings
Magnus Lie Hetland
- Sequence number
- Chapter number
- Chapter 3