Question #175417

After the Python code below has run, what happens if 'the_file' does not already exist?

try:

   fin = open('the_file', 'r')

except:

  fin = open('the_file', 'w')

fin.close()


Expert's answer

If the file does not already exists, a new file is created for it as specified by the except block of code


LATEST TUTORIALS
APPROVED BY CLIENTS