English

Differentiate between text file and binary file.

Advertisements
Advertisements

Question

Differentiate between text file and binary file.

Distinguish Between
Advertisements

Solution

Text File:

A text file contains only textual information consisting of alphabets, numbers and other extensions like .txt, .py, .c, .csv, .html, etc. Each byte of a text file represents a character.

Each line of a text file is stored as a sequence of ASCII equivalent of the characters and is terminated by a special character, called the End of Line (EOL).

Binary File:

Binary file consists of data stored as a stream of bytes i.e. as it is stored in computer memory (binary language). No translation occurs in binary file. In binary file no end of line translation. Faster than text file.

shaalaa.com
Types of Files in Python
  Is there an error in this question or solution?
Chapter 2: File Handling in Python - Exercise [Page 37]

APPEARS IN

NCERT Computer Science [English] Class 12
Chapter 2 File Handling in Python
Exercise | Q 1. a) | Page 37
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×