
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.
Python 3.7: Replace String Method - YouTube |
4 Likes | 4 Dislikes |
317 views views | 14,790 followers |
Education | Upload TimePublished on 12 Aug 2018 |
python tutorials point,python tutorials pdf,python tutorials point pdf,python tutorials for beginners,python tutorials advanced,python tutorials video,python tutorials best,python tutorials opencv,python tutorials django,python tutorials basic,python tutorials gui,python tutorialspoint list,python tutorialspoint regex,python tutorialspoint tkinter,python tutorials for beginners pdf,python tutorials youtube,python tutorials online,python tutorials w3schools,tutorialspoint python class,tutorials python 3
Không có nhận xét nào:
Đăng nhận xét