Write on a file

w means write

a means append

r means read

r+ means read + write

using w will overwrite the entire file

while a will just add data at the end of the existing data 

If in name of file u add any number or alphabet it will create another file with just the data u added but only in w mode.

Check if file is readable, writeable, use readline and readlines to see the data in the file 

 f=open("sdfsf.html", "w")

f.write("\nPama 100K")
f.close()

Comments

Popular posts from this blog

Multiple linear regression for GW depth estimaition

Class in Python

To check if a student has a honor's degree (Using Class in python)