Save this video free

Python (Fall 2026) Module 8-2: String Methods for Manipulation

Bill Moseley, Ph.D. - Computer Science Educator · 10:04 · Watch on YouTube

Part of Bakersfield College COMP B10. See all 47 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Bill Moseley explains how Python's `str.split()` breaks text into a list, including how its separator and `maxsplit` arguments control the result. He builds a reusable `wordCount` function that returns 13 for an example sentence, then demonstrates `str.join()` to combine list elements using a chosen separator.

Key takeaways

Chapters

0:00 Using `str.split()` to Count Words
4:44 Controlling `split()` with Separators and `maxsplit`
7:19 Reassembling Text with `str.join()`

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:01 So string methods are, string methods that we  have available to us for manipulating strings can help us do things with a string.  For example, string.split allows us to take a string and break it up into a list  using any character we want as a separator. Now this uses a default argument of the  separator, and there's also another default in maxsplit. So if I don't pass it any parameters,  what it does is it splits a string on the space, and it will split as many times  as there are spaces in the string. But I could also tell it to split on each period  in, in the sentence. And I could tell it only

0:57 split one time if I wanted to. string.split  is very useful, because if I have a string like this one here, I do this, I turn it into a list using  string.split. So strText.split. I can print out that list. Oops, wrong program. Let's use the  current file. How about, there it is. So there's my string split into a list. Now  you can see it's, it looks just like a list,

1:52 a list of strings, but that's pretty  useful for a lot of things. Now I have a list of all of the words in this  string. Guess what I can do? I can print. If I print the length of that, I can tell you how many words are in that string. So I can feed it now any type of string that  I want, and it will tell me how many words. So right here I could very easily create  a function from this that will tell me how

2:50 many words are in any string that I feed it.  So let's try that. So if I say def wordCount, strText,

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.