Python File I/O: Append text to a file and display the text
Python File I/O: Exercise-3 with Solution
Write a Python program to append text to a file and display the text.
def file_read(fname): from itertools import islice with open(fname, "w") as myfile: myfile.write("Python Exercises\n") myfile.write("Java Exercises") txt = open(fname) print(txt.read()) file_read('abc.txt')
Python Exercises Java Exercises
Python Code Editor:
Improve this sample solution and post your code through Disqus