1 00:00:01,100 --> 00:00:04,080 - [Instructor] Just a quick overview of some file concepts 2 00:00:04,080 --> 00:00:05,370 before we begin. 3 00:00:05,370 --> 00:00:08,720 In Python, it views a text file 4 00:00:08,720 --> 00:00:11,360 simply as a sequence of characters, 5 00:00:11,360 --> 00:00:14,120 and the first position in the file 6 00:00:14,120 --> 00:00:16,840 is the character at position zero, 7 00:00:16,840 --> 00:00:20,950 so it's kind of like indexing through a list, for example. 8 00:00:20,950 --> 00:00:23,590 Python also does support binary files, 9 00:00:23,590 --> 00:00:25,470 which are simply sequences of bytes, 10 00:00:25,470 --> 00:00:28,570 and the first byte in the file would be at position zero, 11 00:00:28,570 --> 00:00:30,710 and you might use binary files, for example, 12 00:00:30,710 --> 00:00:33,130 for things like images or videos. 13 00:00:33,130 --> 00:00:35,670 And there are some standard file objects 14 00:00:35,670 --> 00:00:38,710 that are pre-defined for you if you need them. 15 00:00:38,710 --> 00:00:39,910 You can access them 16 00:00:39,910 --> 00:00:43,490 through the Python standard library's sys module. 17 00:00:43,490 --> 00:00:48,370 We have sys.stdin for the standard input stream, 18 00:00:48,370 --> 00:00:51,590 and even though it's referred to as a file object, 19 00:00:51,590 --> 00:00:55,130 by default, the standard input stream reads input 20 00:00:55,130 --> 00:00:58,240 from the command line, although you can redirect it 21 00:00:58,240 --> 00:01:00,950 to get input, for example, from a file. 22 00:01:00,950 --> 00:01:03,490 And then separately, the standard output stream 23 00:01:03,490 --> 00:01:05,530 and the standard error streams 24 00:01:05,530 --> 00:01:07,700 are going to display information 25 00:01:07,700 --> 00:01:09,830 at the command line by default, 26 00:01:09,830 --> 00:01:12,823 but again, those also can be redirected.