From the course: Python Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Strings

Strings

- [Instructor] All right, this is an exciting one. In Python, we're working with strings a lot, whether it's parsing them to extract some data or constructing them to provide some information to an end user. And Python has a lot of tools to both analyze and construct strings. And the first one I want to take a look at is called slicing. It's called slicing because we're literally taking a slice out of a string and returning it. So let's make a string. "My name is Ryan Mitchell." Okay, and let's say we want to get just the first character of that string. We can do name zero. Remember, programmers always start counting from zero, so we say that m is at index zero in the string, and we could also get the second character, name one, which is that y at index one in the string. Well, what if we want to get the first seven characters of a string? The words my name. We could use a colon, zero colon seven, which means get me…

Contents