Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Built-In String Methods: Overview

Methods are similar to functions. A method is a specialized type of callable procedure that is tightly associated with an object. Like a function, a method is called to perform a distinct task. But it is invoked on a specific object and has knowledge of its target object during execution.

In this section, you’ll explore several categories of string object methods:

  • Case conversion
  • Find and seek
  • Character classification
  • String formatting
  • Converting between strings and lists

00:00 Welcome to Section 2. This video is going to cover the string methods overview.

00:06 To understand methods, you need to know that they’re very similar to functions.

00:12 A method is a specialized type of callable procedure. It’s tightly associated with an object. When creating objects in object-oriented programming, you can define methods that can later be called upon those objects.

00:25 I will include links below this video to additional articles and courses here on Real Python where you can learn more. Like a function, a method is called to perform a distinct task, but they’re invoked on a specific object. And because of that, it will have knowledge of its target object during its execution.

00:45 The syntax that’s used starts with the name of the object—in this case, obj, a dot (.), and then the name of the method. Inside the parentheses, like you would in a function, you can pass arguments. The variety of the string methods you’re going to learn, in some cases, take no arguments, and some may take one or have additional optional arguments.

01:09 I’ll describe that in much more detail as you continue on. What kind of methods are you going to cover? There’s several categories.

01:16 You’ll start off talking about case, meaning upper and lower or title—different types of case formats and how they can be applied to your strings. Then, as you’ve done a little bit with indexing, it might be handy to find strings inside of other strings, creating substrings and so forth. So, a little bit of find and seek methods.

01:36 Then, what type of characters are we dealing with? We’ve already talked about ord() (ordinal) and its conversion to characters individually, but there’s also a need to find what kind of characters are inside of a string.

01:47 Next, a whole set of string formatting methods. Then, how to convert between strings and lists. Lists are a data type that are a whole other subject to themselves, so I will show you the basics and then discuss how to convert between the two.

02:02 So, I think you’re ready to start—with case conversion methods.

Become a Member to join the conversation.