programming-examples/python/Input_Output/Python program to append text to a file and display the text.py

8 lines
293 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
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')