 Hi everyone. In this tutorial, we're going to talk about that, how to count characters, words and lines from a file in Python language. In this example, I'm going to use a file from this path. File name is cities in UK. In this file, we have 20 cities in UK. I think they are ranked by population. I'm going to resize this window. And I'm going to copy this path. And I will use this file. We're going to read all cities from this file. And we're going to count the number of words, lines and characters. So first, we need to open a file. I'm going to copy this path. And we're going to use file cities in UK. We want to read from this file. So we're going to have a mode, which stands for reading. This open function is going to return file object. We want to keep this file object in a variable. We're going to call it in file. Now I want to read all characters from this file. And I'm going to store all characters from this file in a variable. I'm going to call that variable data. And I'm going to read all info from this file. So we're going to say in file.read with this function. We're going to read all cities from this file. In this variable, we have all cities from our file. And then we're just going to count characters, words and lines from this file, which are currently stored in data variable. First, we want to find number of characters. We're going to call length method with data argument inside it. And this method is going to return the number of characters inside this data variable. Then we want to find number of words. And we're going to call again length function. And we want to split all this data with spaces and new lines. And let's count the number of lines. We're going to use again function length. And we want to split lines of our data. So in this last pression, we're going to split our data by lines. And then we're just going to count these lines. Let's just print number of characters, number of words and number of lines. So this file has 189 characters, 23 words and 20 lines. That's all in this lesson. Thanks for watching. Don't forget to subscribe to my channel. See you in the next video. Bye, everyone.