There are three file processing modes in Python: read-only(r), write-only(w), read-write(rw) and append (a). So, if you are opening a text file in say, read mode. The preceding modes become: “rt” fot read-only, “wt” for write and so on. Similarly a binary file can be opened by specifying “b” along with the file accessing flags (“r” ,”w”, “rw” and “a”) preceding it.