once file is opened for readingwe can call the readreadlineor readlines method to get the contents of the file the read method returns the entire contents of the file as str or bytes objectdepending on whether the second argument is 'bfor readabilityand to avoid reading large file in one goit is often better to use for loop directly on file object for text filesit will read each lineone at timeand we can process it inside the loop body for binary files however it' better to read fixed-sized chunks of data using the read(methodpassing parameter for the maximum number of bytes to read open('fileone',' +' readline('this is the first line \nf readline('this is the second line \nwriting to filethrough write method on file objects will writes string (bytes for binary dataobject to the file the writelines method accepts sequence of strings and write each of the iterated values to the file the writelines method does not append new line after each item in the sequence finally the close(method should be called when we are finished reading or writing the fileto ensure any buffered writes are written to the diskthat the file has been properly cleaned up and that all resources tied with the file are released back to the operating system it' better approach to call the close(method but technically this will happen automatically when the script exists an alternative to method overloading method overloading refers to having multiple methods with the same name that accept different sets of arguments given single method or functionwe can specify the number of parameters ourself depending on the function definitionit can be called with zeroonetwo or more parameters class humandef sayhello(selfname=none)if name is not noneprint('hello nameelseprint('hello '#create instance