Unit III File Handling , Classes_Part2
Unit III File Handling , Classes_Part2
creating file
open function
file open()
read() operation
example:
example 1
#example1
f=open("D:/test1.txt",'r')
print(f.read())
-------
output:
hello everyone welcome to python classes
example2
f=open("D:/test.txt","r")
print(f.read(5))
---------
output:
hello
append()-example
#append example
f=open("D:/test.txt","a")
print(f.write("this is a appending operation in file"))
-------------------------
output:
37