 Hi everyone, in this tutorial, we're going to talk about the open function in Python language. Before you can read or write a file, you have to open it using Python's built-in open function. Open function returns object of the file type, or it returns IoError if file does not exist. Open function has three arguments. First argument is the file name to be opened. For example, my file equals to openfile.txt. I'm gonna type this code in my Python IDLE, so I'm gonna say my file equals to and then I'm gonna call open function and I'm gonna provide just first argument of this function. And as you can see, we're going to get an IoError, so this open function returns object of the file type or IoError. In this case, it's going to return IoError because there is not such a file or directory file.txt, that means that in my current working directory, I don't have the file with this file name, but in the case, if I'm having it, then this function is going to return object of the file type and this object is going to be stored in my file variable. Then let's talk about second argument in open function. Second argument is a mode. In Python, we have few modes. First mode is reading mode and it's represented by letter R and it's default in Python language. Then we have W, which stands for writing mode. You should be careful when you use this mode because this mode all the times deletes all existing content in the file that you provide for usage in this open function. Then we have append mode. With this mode, we can append new content to the end of file. Then we're having reading and writing mode, which is represented with r plus. Also with open function, we can open two types of files. First type of files, which is default is text mode and second one is binary mode. For example, we can open a file which is called file.txt. We're going to open it for reading and we're going to store that file object inside variable, my file. I'm going to write this code. I'm going to use again my file variable and I'm going to open file.txt, but at this time I want to open it to write to it. So I'm going to use w mode, which stands for writing to a file. And then we have third argument, which is an encoding. In this video, I do not want to cover this topic about encoding and I'm not going to show you the full list of encoding in Python, but I'm going to put a link down below in the description, with which you can find more information about encoding. I'm going to mention here just few encodings. For example, asking encoding stands for English characters. Then we have a lot of encodings of international standard organization. For example, for Central and Eastern Europe characters. Then for Cyrillic alphabet, for Arabic, Greek, Western Europe, Hebrew, Turkish and much more. Also we have UTF-8, which covers all languages. UTF-16, which covers all languages too. And for example, we have encoding for Japanese. You can find this full list in a link, which I'm going to provide you in the description down below. And for example, we can open our file for reading. We're going to say that our file is going to have encoding UTF-8. Now I'm going to type this code to see if it's working. I'm going to use some other variable. For example, my file 1. I'm going to open file 1.txt for writing. And I'm going to say that it has encoding UTF-8. And let's see, does it work? It worked. That's all in this lesson. In this lesson, we've talked about open function in Python language. Don't forget to subscribe to my channel. See you in the next lesson.