Q. When a file is opened for output, what happens when?


(i) The mentioned file does not exist

(ii) The mentioned file does exist


Answer =

(i)
• If file is open in read mode then it give error.
• If file is open in write or append mode then file created by python.

(ii)
• If file is open in read mode then python read the data according to program.
• If file is open in write mode then python delete all data and write new data according to user.
• If file is open in append mode then the data in the file is retained and new data being written will be appended to end.

2 Comments

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

Post a Comment

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

Previous Post Next Post