CSE 1010 Lecture Notes - Lecture 25: Mkdir, Newline, Empty String
WEEK 15 - LECTURE 25 - FILES
● A file is a collection of data or information that is stored in secondary device.
○ We usually use files for storing data which can be processed by our program.
○ Files are used to store data permanently.
○ There are two types of files:
■ text files (contain ASCII)
■ binary files (contain non-ASCII, audio, video, photo)
● Python provides basic functions and methods necessary to manipulate files by default.
○ Before you can read or write a file, you have to open a file using Python's built-in
open() function.
○ open() returns a file object, and is most commonly used with two arguments:
filename and mode
■ fileobject = open(filename, mode)
jadetortoise401 and 55 others unlocked
84
CSE 1010 Full Course Notes
Verified Note
84 documents