In this Python 3.7 tutorial we are going to look at the replace string method in Python. For more information and a full written tutorial visit
Transcript:
Hello and welcome back to another Python tutorial my name's Tom with Master Code online as always don't forget to like share and subscribe to her tutorials in today's tutorial we're going to go ahead and take a look at the replace string method what to replace string method does is it takes two arguments the first one being the occurrence that we want to replace and the second one being the substring we're going to replace it with so they replace method will go through the string look for the occurrence when it finds out of currency is going to go ahead and replace it with a.
Substring that we provide as an argument example.
A represent a string and Ruby Mississippi Mississippi.
Argument is we want to go ahead and replace all the S's with Z's alright so let's go and try to say. Replace and our first argument can be there currents that we're going to replay so he can do that, and NZ like that and go ahead and close out your script so we got to ask for going to replace Z is what we're going to replace it with the return and there you go yet.
Mississippi I think it should really look like that.
Or should we smell like.
So there you go there's to replace string method now let's take a look at.
Argument that we can pass it and it's how many occurrences is going to replace so let's take a look at this real quick.
And this time we're going to say ask again and replace it with Z this and then we're going to provide a third option argument and that's how many occurrences we want to replace I'm going to say to it return and there is m i z z i s s i p p i all right so we can.
Count how many we want to replace so that is the replace string method in Python if you have any questions head over to master code. Online otherwise I'll see you next.
Sur cette page du site, vous pouvez voir la vidéo en ligne Python 3.7: Replace String Method durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Code master 12 août 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,259 fois et il a aimé 12 téléspectateurs. Bon visionnage!