Computer Science, asked by kartiknarade15, 9 months ago

Differentiate between the following:

a) F = open(“dairy.txt”,’r’)

b) F = open(“diary.txt”,’w’)​

Answers

Answered by Anonymous
6

Answer:

hi..

Explanation:

-in the first one the file will be opened in reading mode..ie.you can only read the file and cannot write or append anything to it...

-whereas in the second one the file will be open only in the write mode..ie.you can only write in the file and you won't be able to read anything..

•••apart from this in read mode if the file will exist then the file will be open for reading purpose but if the file doesn't exist error will be shown...

•••whereas in write mode if the file exist then the content will be overwritten in the file and the old content will be erased..whereas if the file doesn't exist a new file will be made available to write...

hope it helps you...✌️

Similar questions