Python 3.7: Partition String Method

preview_player
Показать описание

Transcript:
Hello and welcome back to another Python tutorial my name is Tom with Master Code Online as always don't forget to like share and subscribe to our channel in today's tutorial we're going to look at the partition string method in Python.

The partition string takes an argument which we consider it a separator it will look for that argument with in the string now if it's located in the string then the returns three strings contained in a tupal the first string will be the first portion of the string the second string will be the actual argument or the separator and then the third string will be the remainder of the string.

That might be all confusing to you so we're going to create a string and that string will be represented by a where the string will be master code online like that and we will call the partition string method like that and we're going to pass in the separator argument.

So now we got a tupal indicated by the parentheses on the outside here and now we got a string master and a white space that Returns the argument because it was found within the string and then it Returns the remainder of the string so this is the partition string method.

If we do not locate the separator with in the string.

That will do. Partition.

master all right now this argument is not found we have returned three string still the whole string that we passed the method on one will be returned in the first string and the two remaining strings will be empty string still contained so that's what happens when it does not questions about the partition string method please let us know it master code. Online otherwise we'll see.
Рекомендации по теме