Python Basics: Strings and String Methods (Overview)

Many programmers, regardless of their specialty, deal with text on a daily basis. For example, web developers work with text input from web forms. Data scientists process text to extract data and perform tasks like sentiment analysis, which can help identify and classify opinions in a body of text.

Collections of text in Python are called strings. Special functions called string methods are used to manipulate strings. There are string methods for changing a string from lowercase to uppercase, removing whitespace from the beginning or end of a string, replacing parts of a string with different text, and much more.

In this video course, you’ll learn how to:

  • Manipulate strings with string methods
  • Work with user input
  • Deal with strings of numbers
  • Format strings for printing

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course.


Sample Code (.zip)

9.6 KB

Course Slides (.pdf)

2.3 MB

00:00 Welcome to Python Basics: Strings and String Methods. I’m Christopher Bailey, and I’ll be taking you through this course. Python programmers deal with text daily, whether it’s displaying text on a web page or within a graphical user interface, or even accepting input a user has typed into your application.

00:19 There are even entire segments of data science that deal with extracting information from text, such as sentiment analysis. Collections of text in Python are called strings, and there are special functions called string methods used to manipulate strings, like changing a string from upper to lowercase or removing whitespace or replacing portions of the string with different text. In this course, you’ll learn how to do some of that manipulation of strings using string methods. You’ll work with user input.

00:50 You’ll learn how to deal with strings of numbers and turning numbers into strings. How to format strings for printing.

00:59 And along the way, you’ll learn about f-strings, multiline strings, how to do string indexing and slicing, what is string immutability, and how to discover additional methods using IDLE yourself.

01:15 Let me quickly take you through the table of contents. There’s this overview that you’re watching currently, then you’ll define what is a string. Next up is concatenation, indexing, and slicing of strings, and then how to do some of that manipulation of strings using methods.

01:31 You’ll learn how to interact with user input, and then working with strings and numbers, how to streamline your prints, and then how to find strings within strings.

01:42 Then you’ll wrap up with a summary and a collection of additional resources for you to continue your learning. All right, it’s time to dig into what is a string.

whiffsgliders06 on Oct. 30, 2022

First video isn’t working, but others are.

Bartosz Zaczyński RP Team on Oct. 31, 2022

@whiffsgliders06 Hi, thanks for the feedback. Can you please elaborate on how the video isn’t working for you? Does it not start playing? Have you noticed any errors in the web developer’s console in your browser?

tracyelliott79 on Feb. 12, 2024

Hi there, quick question would it be ok to use pycharm rather than python idle?

Bartosz Zaczyński RP Team on Feb. 12, 2024

tracyelliott79 Absolutely! As long as you feel comfortable with PyCharm, go for it! Bear in mind, however, that it’s a full-fledged IDE that may feel intimidating at first.

Become a Member to join the conversation.