 So the last idea I want to talk about is this concept of what we call the with command now As you can see sort of first before I even talk about the with command I want to kind of jump back to thinking about how we use Looping in Python, right? So the idea is that we started with this idea of a while loop and The big thing about the while loop was you know, we had to create this sentinel value This this eye that is effectively gonna have to then control that while loop and at the very end You know, we had to make sure that we went through and iterated that I So we could continue to have the loop run in this case 10 times So there were a lot of steps notice it, you know I'm indicating like three particular spots that you had to focus in on your code and What we then introduced was this idea of the for loop and you can almost imagine What the for loop does is it takes all of those? Individual parts right of the wall of how the file How the while loop works it it's doing for example this I Starting at zero in our case We're gonna give a value to I We're saying as long as this Conditional is running as long as I is less than 10 continue to run We're doing a similar approach now with a list the range Function is creating a little list of numbers for us to iterate through and Since that range function does, you know, it does Zero one two three four five six seven eight nine Right. I is gonna be starting with zero Then it's gonna become one this we come to Etc. Etc. Etc. Etc. So Suddenly the while the for loop is sort of a condensed version of the while loop the same thing can happen with our With keyword the idea is if we look at file handling, right? We've got first this concept where I have to add a variable and I have to Open it up and that's you know, again, I need to do that That's creating an object that I can then do my reads from Same kind of thing going on here I would then have to use some keyword or some command to Extract out the values from that file and in my case, I'm saving it to contents But the last little bit there is I have a final line where I have to make sure that I close the file after I'm done because again as we'll get into that can become a big issue and We want to make sure that once we've opened a file. We close it now this with command right here By having the with command what we're actually saying is a similar approach to again the for loop with this object Being named Phi right Now we've effectively said, okay, I'm gonna tab in Right here. I'm gonna tab in and everything that's inside of this indentation this little block It's going to be treated as if the That file that we're working off of has been opened is ready to be read And we're going to refer to that file as phi so we can take a look at this Actually, if we took a look at say some of the code that we've been working off of thus far, right? Let's say for example, let's Take out and let's do the same thing with what we're doing with lines six through nine The big factor would be all i'm doing is i'm going to come in Remove out that phi.close again with commands automatically do that for us And now i'm just going to do a little bit of tweaking So that with open file name r as phi And then content gets tabbed inward And so again if I run this No errors are going on except for driver updates Uh Same kind of concept can go on when I then work off of my right file So I could come in and do the same structure with Open my output phi as w or as uh Output phi writing as phi And then all of these lines of code Go ahead and tab them in and I don't need that phi.close anymore And so as you can see I I go through I run it And we're not seeing any errors because again what we're doing is we're writing to a particular file But the reason behind this is again, it's It's one the recommended way to uh handle files inside of the python community and two Again, it helps start to reduce down all of the The the work you have to do. I no longer have to have a close command in my code It's already sort of implied with our with statements