Page 81 - PYTHON-12
P. 81
Program 12: Write a Program to read data from data file and show Data File Handling
related functions utility in python.
Solution:
f=open("test.txt",'r')
print(f.name)
f_contents=f.read()
print(f_contents)
f_contents=f.readlines()
print(f_contents)
f_contents=f.readline()
print(f_contents)
for line in f:
print(line, end='')
f_contents=f.read(50)
print(f_contents)