 Hi, everyone. In this tutorial, we're going to talk about that how to write to a file in Python language. In this example, we're going to work inside this Python folder, so I'm going to copy this path to use it later. Here you can see that this folder is empty, but we're going to create a file and inside this file we're going to write some text. So basically what we need to do in this example is to open a file and write some text inside it. I'm going to use this path and inside it I'm going to create a text file. I'm going to call it output.txt. You can notice that this our working folder is currently empty, but if this file does not exist, new file with this file name is going to be created after usage of this open method. And also this open method has two parameters. Second parameter is going to be a mode. We want to have write mode for this file because we want to write to this file. Let's say simply w, which is going to represent write mode. So after using this method, this file is going to be created, but if you already have this file inside this path and if you're using write mode, you need to be careful when opening this file in write mode because write mode clears all data from our file. And finally here I'm going to refer this opened file to a variable. I'm going to call this variable file. You can use some different name for your variable. It doesn't matter. So you can notice that our folder is empty. But after the usage of this open method, output file is going to be created. This file is currently empty. So let's write some text inside it. I'm going to create a variable. Let's call it, for example, variable line. And I'm going to put some text inside it, for example, how to write a file in Python. And then I'm going to write this line of text to this file. So I'm going to say file, which is going to refer to this file. And I'm going to use write method and inside it as an argument, I'm going to put this line of text that I want to be written in this file. Then I'm going to press enter. And the returning value of this write method is the number of characters that were written to this file. In our case here, we have 30 characters. And finally, when we don't want to write more text to our file, simply we're going to close it with this close method. Now I'm going to press enter. And now let's check our file inside this folder. And as you can see here, this text here is written here. That's all in this tutorial. Don't forget to subscribe to my channel. See you in the next tutorial.