 Now so far we've talked about reading contents, but what if we want to write our contents? Well, you may notice that once again, we're focusing in on this idea of using the open function that Python has available to it But instead of doing R, we would change this to a W and I'm going to continue using the with structure to this so with open In this case, I'm not going to change readings at txt. I want to have a new file I don't always need to make it a variable, but in this case I Am still going to do an absolute file path new file dot txt Right Same kind of concept I'd go in and say as f Now whatever I may want to write into my file is where I would come in Here so I have a file. It's available Now I need to write to it. Okay. Well in this case, let's say for example I want to extract out that that fourth number in each line So I see that each line is basically, you know, gonna be a single digit some ID number in this case This is a floating point timestamp and then our our number. So, okay Well, I happen to have my contents no different than when we were working off of a list structure in the past so for line in contents Let's see I want the Data we'll call it data At line dot split and Then my value or number Number is going to equal int data at let's see that is a 0 1 2 3 so I want that 3 and That is not how you spell number Okay, so I've extracted out again the number, but I haven't done anything to my file So how do I write to my file? Well in that case, it's still phi and very similar to what we are dealing with when we were working off of Reading so phi dot read lines. We can do phi dot write Now I am going to add in a new line so that each number appears sort of on its own line And to do this I am going to do a little string formatting so oh 1 or 0 curly braces slash in format number And we take this and we run it What do you know? It's done now. What does that look like on sort of the? Outputted file world well if we come in you may notice. Oh, hey, what do you know? There's that new file that we just built. Let's take a look and You can see all of those file or numbers are on their own line Now once again if you think about it the reason why I did that slash in is if I don't have that as my my code and I Write this file and not to spoil it If I were to then take a look again if you think about it all I've said is Print the number into a file. That's it and very explicitly only print the number to a file So if we were to take a look at new file that TXT That's exactly what we see Every file every number is sandwiched right beside itself with no Spacing or anything of that nature So that's where something like the slash ends or the commas slash in may come into play or a comma or even Something like you know using the pipe But some form of a delimiter could come into play and that's why again I'm just using slash in put it all on one line Or all on a new line