FILE HANDLING ============= FILE ==> A PERMANENT STORAGE TWO TYPES: 1) TEXT FILES ==> .txt 2) BINARY FILES ==> image file (.jpg/.jpeg) audio file (.mp3/.mpeg) video file (.mp4) Pdf file Zip File etc. Open a file: ============ open() ==> a built-in function which can be used to open the file Syntax: file-object/file-pointer = open("file-name-with-extension", "mode-of-file") here: mode-of-file ==> reason to open the file writing/reading/both/appending etc. ex: fp = open("abc.txt", "w") File Modes: =========== w-mode r-mode a-mode w+-mode r+-mode a+-mode x-mode Note: ===== above all modes for only "text files". w-mode ====== write-mode ==> if the file-name (specified) is not available, "w-mode" can create the new-file with the specified name. ==> if the file is already existed with some text/data: w-mode can delete all the data what we already have and open Because, by default the w-mode can always pointing to '0th' character. r-mode: ======= read-mode ==> read-mode can always allowed to open the existing files only. ==> for the existing file, "r-mode" while open it will not flush the data. a-mode: ======= append-mode ==> read + append (after the old content, it can add) if the file is not existed ==> can create new if the file is existed ==> can open w+-mode: ======== write + read r+-mode: ======= read + write a+-mode: ======== append + reading x-mode: ======= ==> same like w-mode ==> x-mode can always open the new file only existing files cannot open.