0% found this document useful (0 votes)
8 views2 pages

EEE 111 Lesson

The document explains the function view of a computer, detailing how data is loaded from secondary to main memory during program execution. It defines a file as a named location on a disk that stores information permanently and distinguishes between text (ASCII) files and binary files. Additionally, it introduces escape sequences and the syntax for the open() function used in file handling in Python.

Uploaded by

Yohan Alkayde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

EEE 111 Lesson

The document explains the function view of a computer, detailing how data is loaded from secondary to main memory during program execution. It defines a file as a named location on a disk that stores information permanently and distinguishes between text (ASCII) files and binary files. Additionally, it introduces escape sequences and the syntax for the open() function used in file handling in Python.

Uploaded by

Yohan Alkayde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

LESSON: FILES

FUNCTION VIEW OF A COMPUTER


- Upon program execution, all data (e.g., variables) related to the program are loaded from the
secondary memory to the main memory.

WHAT IS A FILE?
- Named locations on the computer’s disk that permanently store information for future use of its
data.
- Used to permanently store data in non-volatile memory (e.g., hard disk) as opposed to volatile
sources like RAM

TEXT FILES AND BINARY FILES


1. Test (ASCII) File
- Consists of ASCII characters
- Usually created by using a text editor such as Notepad
- ASCII table
o Original: 7-bit character set
o Extended: 8-bit character set
2. Binary File
- Executable files, image files, sound files, etc.
- File that contains bits of 1s and 0s
- Strictly speaking, all files are binary files.

ESCAPE SEQUENCE
- A sequence of characters that has a “special” meaning.

Escape Sequence Meaning


\\ Backslash
\’ Single quote
\” Double quote
\n New line
\t Tab
\b Backspace

FILE HANDLING: open() Function

- Syntax: fileHandle = open(filename, mode)


o Filename – name of the file you want to open
o Mode – mode in which the file will be opened
o fileHandle – object for Python to access the file
- Modes
o ‘r’ – for reading (default)

You might also like