programming-examples/python/Input_Output/Python program to read a file line by line store it into a variable.py

5 lines
167 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def file_read(fname):
with open (fname, "r") as myfile:
data=myfile.readlines()
print(data)
file_read('test.txt')