QuestionQ100Verified/Miscellaneous (List Comprehensions, Lambdas, Closures, I/O)Copy linkReport a problemAsk AstroTutorSave questionWhich of these statements are true?Choose twoAif open()'s second argument is 'r', the file must exist or open will failBthe second open() argument describes the open mode and defaults to 'w'Cif open()'s second argument is 'w' and the invocation succeeds, the previous file's content is lostDclosing an opened file is performed by the closefile() functionShow AnswerAnswerExplanationRead mode ('r') opens an existing file and fails if the file does not exist. Write mode ('w') truncates an existing file when the open operation succeeds, so its prior contents are lost. The default mode is 'r', and an open file is closed with its close() method.Show comments1Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion