Q. Write a Python program to open the file hello.txt used in question no 6 in read mode to display its contents. What will be the difference if the file was opened in write mode instead of append mode?


Answer :-

f = open("hello.txt","r")
x = f.read()
print(x)  
  


If file is open in write mode then the older containt of file will remove automatically while if file is open in append mode then the older data will not delete.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post