Learn: String processing¶
Four short tutorials that build up your working knowledge of Python strings, from indexing to formatting to searching. Each one is a Jupyter notebook — read it in the browser, and edit and run any code cell directly on the page.
The tutorials build on each other, so working through them in order is the fastest path. Each takes roughly fifteen to twenty minutes.
The sequence¶
- String basics — string literals, indexing, slicing, and concatenation.
- String methods —
split,join,strip,replace, and the other methods you'll reach for constantly. - String formatting — f-strings, the format mini-language, and shaping numbers and dates for display.
- String searching —
in,find,count,startswith,endswith, and when to graduate to regex.
Before you start¶
You'll get more from these if you're already comfortable with Python variables and basic types. The Functions and Conditional logic guides are good warm-ups.
You don't need Python installed locally — every tutorial runs in your browser. If you'd rather run them on your own machine, each notebook has a download button in the top-right corner.