Please enable JavaScript.
Coggle requires JavaScript to display documents.
File Operations - Coggle Diagram
File Operations
Open - to write
Python
fileHandle= open ('filename.extension', 'w’)
-
Open - to read
Python
fileHandle= open ('filename.extension', 'r')
-
-
-
-
-
-
File handle
In order to read data from or write data to a file using a computer program, the file must be given a file handle. A file handle is a temporary label used by the program itself to identify that file. Every time the program needs to use the file, it will refer to it using the file handle.
File/file access modes
When using a file in a computer program, you must specify the file/access mode you would like to use. This tells the computer program what you are allowed to do with the file.
r - read only
w - write mode
a - append
r+ or w+ - Allow both read from and write to the file
a+ - open or create a file for reading and allow data to be written at the end of the file
-
-
File extension
Every file is given a name when it is created, and usually, an extension, telling the computer and the user what type of data the file contains. Text files have the extension .txt.
-
-