1 00:00:00,000 --> 00:00:04,330 When you create a file object, a file 2 00:00:04,380 --> 00:00:07,500 object is created in RAM, and it's going 3 00:00:07,530 --> 00:00:10,560 to remain there until the execution of 4 00:00:10,560 --> 00:00:13,380 your program ends. Therefore, it might 5 00:00:13,380 --> 00:00:15,570 be a good idea to actually close the 6 00:00:15,570 --> 00:00:17,970 file, and so that the file is deleted 7 00:00:17,970 --> 00:00:20,070 from the memory, once you are done 8 00:00:20,070 --> 00:00:22,470 processing that file. For example, in 9 00:00:22,470 --> 00:00:25,050 this script, you are creating the file 10 00:00:25,050 --> 00:00:27,780 object, and here you are reading the 11 00:00:27,780 --> 00:00:30,150 content of that file object and storing 12 00:00:30,150 --> 00:00:32,850 it as a string. So myfile.read 13 00:00:33,120 --> 00:00:36,477 output a string, which represents the 14 00:00:36,502 --> 00:00:39,240 text of the file, that stream will be 15 00:00:39,240 --> 00:00:42,030 stored in this content variable. So here 16 00:00:42,030 --> 00:00:44,010 I'm done with processing the file, then 17 00:00:44,010 --> 00:00:46,590 I can, after that, I'm just processing 18 00:00:46,620 --> 00:00:48,450 the stream that I saved in this 19 00:00:48,450 --> 00:00:50,970 variable. Therefore, it makes sense to 20 00:00:51,570 --> 00:00:55,560 apply myfile.close, even 21 00:00:55,590 --> 00:00:58,200 though this is not strictly mandatory, 22 00:00:58,290 --> 00:01:00,360 but it's a good idea to use it. So if 23 00:01:00,360 --> 00:01:03,450 you do that, you'll still get the 24 00:01:03,510 --> 00:01:06,120 correct output. Something, you should 25 00:01:06,120 --> 00:01:09,755 know now is that if you apply myfile.read 26 00:01:09,779 --> 00:01:11,010 again, after you have 27 00:01:11,010 --> 00:01:13,230 closed the file, you're going to get an 28 00:01:13,230 --> 00:01:16,920 error. It says that this operation is 29 00:01:16,920 --> 00:01:19,685 being performed on a closed file, so you 30 00:01:19,710 --> 00:01:24,330 cannot do that. So this is how to create 31 00:01:24,330 --> 00:01:26,880 a file and close it. But there is a better 32 00:01:26,880 --> 00:01:30,150 way to do all that. I'll show you that 33 00:01:30,150 --> 00:01:31,153 in the next video. 34 00:01:31,177 --> 00:01:34,506 [No audio]