#this is used to write sth in a file but previous content will be delete
f=open("harish", "w")
f.write("harish is good boy ")
f.close()
#this is used to add sth in a file at end but in this previous content will not delete
f=open("harish", "a")
f.write("harish is goldenba\n ")
f.close()
#in this we can find out how many charecters we add in file
f=open("harish", "a")
a=f.write("harish is goldenba\n ")
print(a)
f.close()
#this is used to read and write both
f=open("harish", "r+")
print(f.read())
f.write("well dude")
Comments
Post a Comment