Abstract
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.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
And if you want a locale-dependent thousands separator, you should use the n type instead.
- 2.
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 ).
- 3.
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.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Magnus Lie Hetland
About this chapter
Cite this chapter
Hetland, M.L. (2017). Working with Strings. In: Beginning Python. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0028-5_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0028-5_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0029-2
Online ISBN: 978-1-4842-0028-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)