Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

Strings and Character Data in Python: Conclusion

In this course, you learned about working with strings, which are objects that contain sequences of character data. Processing character data is integral to programming. It is a rare application that doesn’t need to manipulate strings to at least some extent.

Python provides a rich set of operators, functions, and methods for working with strings. You now know how to:

  • Use operators with strings
  • Access and extract portions of strings
  • Use built-in Python functions with characters and strings
  • Use methods to manipulate and modify string data

You were also be introduced to two other Python objects used to represent raw byte data: the bytes and bytearray types.

Download

Course Slides (PDF)

746.1 KB

Take the Quiz: Test your knowledge with our interactive “Python Strings and Character Data” quiz. You’ll receive a score upon completion to help you track your learning progress:


Interactive Quiz

Python Strings and Character Data

This quiz will test your understanding of Python's string data type and your knowledge about manipulating textual data with string objects. You'll cover the basics of creating strings using literals and the str() function, applying string methods, using operators and built-in functions, and more!

00:00 Congratulations! You’ve completed the course. I’m going to take you through a review of everything that you’ve covered and learned in this course. Section 1 started with an intro and an overview.

00:15 Then you started to talk about string operators, including the concatenation (+), replication (*), and the in and not in operators.

00:30 Then you looked at some of the built-in Python functions that work with strings, such as chr(), ord(), and len().

00:42 Next, you covered string indexing, and there you learned the syntax with the square brackets and how to access individual characters in a string. After covering indexing, you added some additional characters into that syntax to do string slicing, also covering how to do strides.

01:09 And after that, you covered how to interpolate variables into a string using f-strings. And last, you covered how strings are immutable and how they can’t be modified directly, but you can accomplish something similar by copying into a new object.

01:34 Section 2 started with a quick overview about string methods and how they’re similar to functions.

01:46 And next, you dove straight into string methods for case conversion.

01:58 And then, how to find substrings within a string, with a variety of find and seek methods.

02:13 The next video was about character classification. These methods allow you to test the contents of your string objects.

02:26 And then, how you can format strings, things like centering or justifying or removing unwanted characters.

02:42 Last in Section 2 was about converting between strings and lists. So you had to talk about what lists and tuples are, how you can use these methods to break apart a string into a sequence object like a list or a tuple. Then in Section 3, you started to talk about bytes objects with a quick bytes object overview.

03:09 After that, how to define a literal bytes object, using lowercase b in front of your string. The next video described defining a bytes object using the built-in bytes() function, and the three different ways that you can use that bytes() function.

03:32 Next was operations that you can apply to bytes objects. bytes objects have a lot of similarities to the string object you’ve been working with up to this point, so you got to see how operators can be applied and how bytes objects have a lot of the same methods as string objects.

03:52 And the last video that you just completed was about bytearray objects, and similarities and differences between those bytes objects and bytearray, and how to create them. And of course, this course review itself. From Real Python, I want to thank you, and I hope you can practice with what you’ve learned.

Avatar image for MeirG

MeirG on Oct. 14, 2019

I would suggest a “Cheat-sheet” to cover all of this.

Avatar image for lordchuffnel

lordchuffnel on Nov. 3, 2019

bpython is very useful. it’s an easy way to see what methods are available for any item

Avatar image for agerbes

agerbes on Jan. 17, 2020

I can only confirm that, bpython is great! I would also recommend creating a Cheat-Sheet.

I always work with the Atom Editor. Is there a way to extend the editor so that it becomes like bpython, an easy way to see what methods are available for any item.

Avatar image for Chris Bailey

Chris Bailey RP Team on Jan. 17, 2020

Hi @agerbes, I haven’t used Atom for awhile, I was mainly using it for HTML and CSS, so I’m not an expert. Looking around I found this in the packages section of the Atom site: autocomplete-python. It looks like the most popular python related package for Atom, and uses JEDI which is a common tool for autocomplete and code suggestions. I wonder if this might do what you are looking for?

Avatar image for rgusaas

rgusaas on March 6, 2020

Liked the course. Not seeing where bookmarks are set. Maybe they are not available with video?

Avatar image for Chris Bailey

Chris Bailey RP Team on March 6, 2020

Hi @rgusaas, I’m not sure which bookmarks you are referring to? For links to additional resources I’ve covered throughout the course, they are below the video lessons where I mentioned them. Many of those resources are also in the original Real Python article that this course is based on, though I have added some extras.

Avatar image for Ricky White

Ricky White RP Team on March 6, 2020

Hi @rgusaas. The bookmarks are at the top of the page for each video. I can’t embed an image to show you, but it is a bookmark icon next to where it says “Marked as complete” for this video. You can get to all your bookmarks by clicking on you profile image in the navigation and going to Bookmarks.

Avatar image for Cory

Cory on April 25, 2020

I can’t lie when I started this course I thought to myself “this is going to be so boring”. After just a few lessons in I finally realized how important and how useful this tutorial is. Thank you for the multiple examples and clear explanations.

Avatar image for Ponzhi

Ponzhi on Jan. 18, 2022

Seriously, this video course is nice and easy to learn. Thanks.

Avatar image for tonypy

tonypy on April 11, 2023

A significant amount of very useful data. I had to go over some of it several times and also review Python documentation and other references to try and get a better understanding.

I can only handle so much spam, egg, sausage, and spam – even though there’s not much spam in it, so what would be super useful would be to create a new tutorial where most of the concepts are applied in a real application to demonstrate the techniques in practical environment.

Become a Member to join the conversation.