programming-examples/python/Input_Output/Python program to read a file line by line store it into a variable.py
2019-11-15 12:59:38 +01:00

5 lines
167 B
Python

def file_read(fname):
with open (fname, "r") as myfile:
data=myfile.readlines()
print(data)
file_read('test.txt')