learn python file operations

Fileoperations in Python

Current Status
Not Enrolled
Get Started

A basic topic in programming is the processing of files. If information is to be stored until the next program start, this data is written to the hard disk in files. Thus the information remains also after the termination of the program.

After opening a file, it remains locked for further accesses from outside. At this moment, a file can only be processed by the program that opened the file. If you forget to close a file, it remains locked at least until the end of the program. With some operating systems also up to the reboot of the system.

In Python there are two types of files that can be edited. These are text files and binary files. Binary files consist of a sequence of bytes. As we know, bytes represent the language of computers. They also have a unique relationship with the external device or file. The number of bytes written and / or read correspond to the number of bytes on the terminal device.

In addition, binary files are not readable by humans in their encoded state.
Examples of binary files: .pdf, .mp3, .mp4, .png, .exe, .zip and many more.

Text files have no specific encoding and are therefore readable by humans in a text editor. For example, these are the following file formats: .html, .css, .txt, .csv and many more.