From the course: Python Standard Library Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

String manipulation

String manipulation - Python Tutorial

From the course: Python Standard Library Essential Training

Start my 1-month free trial

String manipulation

- In addition to searching strings and performing other basic string operations, sooner or later, you'll have to manipulate string content, so that's what we're going to look at now. So here in my strmanip_start file, I have to find a sample string to get us started. So, to convert between upper- and lower-case letters, you can use the upper and lower functions, so I'll use print, and I'll write test_string1.upper, and then we'll do the same thing, only in this case I'll use the lower function. So let's save and let's run this, and you can see the effect on the sample string. All right, now let's try out the split and join functions. So, I'll comment those guys out and clear the terminal. The split function can be used to break up a single text string into multiple strings, so if I wanted to isolate each of the words in this string into an array, I can use the split function to split the string on the space character. So let's try that out, and I give the split function the character…

Contents