Files Handling
Functions
open() : returns a File object
read() and write() methods on a File object
close() : to close an open File
Open()
Read Mode (default)
Write Mode
Opens file for writing, overwrites if file exists, creates if not.
Append Mode
Opens file for appending, creates if file does not exist.
Create Mode
Create file, error if file already exists.
Read()
Returns the whole text by default. You can specify how many characters you want into the parentheses.
ReadLine()
Returns a line each time the method is called.
ReadLines()
Returns a list containing all lines.
Write()
Last updated