From the course: Introduction to Python: Learn How to Program Today with Python by Pearson
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Manipulate strings - Python Tutorial
From the course: Introduction to Python: Learn How to Program Today with Python by Pearson
Manipulate strings
All right, let's talk about manipulating strings. So now let's talk about working with strings and see what kinds of things we can do with strings. If we open up a Python console and put in a test string in here, Let's do hello world. That's my string. If I said string dot, it actually gives me a lot of options here. These are called string methods. Methods are like functions, except that they act on an object. You give the object, say dot, and then provide the method name, and it could transform it. So for example, I can make the string uppercase like that. And again, we call it because it's like a function. We put parentheses afterwards. Let's see. What else? We have lower, string.lower, make it all lowercase. Other case-related things are capitalize. will capitalize just the first letter, and title case will capitalize each word. Another thing we can do when we are taking in input, actually, if we run happy birthday again, if a very common thing, and I forgot to mention this…
Contents
-
-
-
-
(Locked)
Learning objectives51s
-
(Locked)
Learn about types6m 35s
-
(Locked)
Work with variables14m 9s
-
(Locked)
Debug errors15m 44s
-
(Locked)
Manipulate strings13m 10s
-
(Locked)
Write a Mad Libs program7m 14s
-
(Locked)
Use modules16m 32s
-
(Locked)
Write your own functions16m 7s
-
(Locked)
Write a timer game12m 19s
-
(Locked)
More context: Learn about Python11m 9s
-
(Locked)
-
-
-
-
-
-