Writing and Reading Files (3 marks)
Given the following code snippet: myFileHandler = open(“myFile.txt”) myFileHandler.writeLine(“Hello, world!”) (a) What is the purpose of the writeLine(“Hello, world!”) method? (1 mark) (b) How can you modify the code to ensure that the data is safely saved and the file is closed properly after writing? (2 marks)
Writing and Reading Files (3 marks) Read More »