Hi and welcome back. In this part I am going to tell you about how what is the uses of close flush File Number A seek tell so let's start in my previous video I already told you about read read line and write is add by next. So in this video I will cover all the remaining file optic methods. So let's begin open idle Firstly, I'm going to perform file number operator as a call to obtain Hello dot txt print F dot File Number sorry, file number and close the file. I use it many times how to close a file but just to use this sentence I've taught close it will close the open file, a close file cannot be read or write anymore after this hold on hold on script finish. Now run the script.
Let's check out what is the value of file number three the value which are shores here three is the represent InDesign file descriptor and that is used by the underlying implementation to request IO operations from the operating system. Okay. Let's discuss about tell operator mostly tell operator is used to tell us data file objects position is from the beginning of the file in the forms of bytes C, it will definitely show the output zero because it tells that the file position is zero as in the beginning. And suppose if you want to copy file a two file P and the cursor position must be at beginning of The file a to copy hold sentence to the copy and file B. So this function is mostly used at the time of copy operation. Now I'm going to form flush method.
Blanche marker is basically used to flush all the internal buffer like acid useless. It has no return value, close automatically flushes the data, but if you want to flush the data before closing the file, then you can use this which I'm going to tell you right now. This right flush and this way, I flushed the internal buffer of that fight. No, I competed with claws flourish violin was edited by next name. Let's do this two more functions seek and truncate. Again I have to open it this way which I performed No writer, print F dot seek two comma two two comma two Hello Hello it may be empty c Just open as we'll see, first I read the file till five h e l l o, then I then I move my cursor to the beginning by writing zero comma zero then again it reaches two at the beginning and again I did the file till five, correct and five Kurtzer five till five correctors.
So it printed again Hello and this way I perform how Seek method is used to change the file object position. Opposite indicates the number of words to be moved from where indicates from where the words are to me. This complete completed all this file object methods. So, till now, keep learning, keep growing and love Python and happy coding