# read() function read data character by character
f = open("input.txt", "r")
print("Readable :: ", f.readable())
f.close()
#its Delete All Data From File
'''
f = open("input.txt", "w")
print("Readable :: ", f.readable())
f.close()
'''
#read line by line
f = open("input.txt", "r")
print("\nData :: ")
for i in f :
print(i, end= "")
f.close()
#read character By character
f = open("input.txt", "r")
print("\nData :: ")
for i in f.read() :
print(i)
f.close()
#read line by line
f = open("input.txt", "r")
print("\nData :: ")
print(f.readline(), end="")
print(f.readline(), end="")
print(f.readline(), end="")
print(f.readline(), end="")
print(f.readline())
f.close()
#read by readline() function
f = open("input.txt", "r")
print("\nData :: \n", f.readlines())
f.close()
Comments
Post a Comment