Question: Select a wrapper function safeOpen) for the open)function. Recall that when open) is called to open a file that doesn't exist in the current working

Select a "wrapper" function safeOpen) for the open)function. Recall that when open) is called to open a file that doesn't exist in the current working directory, an exception is raised: >>>safeOpen(ftest.py"r) def safeOpentilename, mode): iny: infile- open(filename, mode) return filename except: return infile O def safeOpenfilename, mode): try: infile open(filename, mode) return infile return None O def safeOpen(mode): try: infileopen (filename, mode) return infile except return infile
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
