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.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )