sscasc@tumkur mode description "ropens file for reading "wopens new file for writing if the file already existsits old contents are destroyed "aopens file for appending data from the end of the file "rbopens file for reading binary data "wbopens file for writing binary data " +opens file for reading and writing " +opens file for reading and writing if the file doesn' existthen new file is created examplesf open('myfile txt'' 'creates file object named capable of reading the contents of the text file named myfile txt in current directory open('myfile txt'' 'creates and returns file object named capable of writing data to the text file named myfile txt we can also use the absolute path to filename to open the file in windowsas followsf open(" :\\pybook\\myfile txt"" "creates and returns file object named capable of reading data to the text file named myfile txt in folder name python in drive open('myfile txt'' 'new data will be appended after the pre-existing data in that file writing text to file the 'wmode creates new file if the file already existsthen the file would be overwritten we will use the write(function examplefile_input open("motivation txt",' 'file_input write("never give up\ "file_input write("rise above hate\ "file_input write("no body remember second place"file_input close(sp_python programming