Python strings have many methods available. This lesson demonstrates a few of the more common string methods.
- [Instructor] The Python string object…has a number of useful methods.…Here are some common ones, here in Komodo.…I've opened a working copy of hello.py,…from chapter 11 of the exercise files.…And you notice down here on line four,…we have our print, hello world.…And if I run this, it prints hello world in our results.…If I use the upper method…on the literal string,…you notice it prints in all capital letters.…
And if I use the lower method, it's in all lowercase.…There's also a capitalize method,…which capitalizes just the first letter…and makes everything else lowercase.…There's a title case,…which capitalizes the first letter of every word,…and there's swap case,…which will swap the case of every letter,…so the capital letters are lowercase…and the lowercase letters are uppercase.…There's also casefold, and if I run this,…you'll notice it makes everything lowercase.…
The difference here is that casefold is similar to lower…but it's more aggressive,…and it removes all case distinctions, even in unicode.…So if I use like a German sharp S here,…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficiently (2017)with Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.