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()
If the file does not already exists, a new file is created for it as specified by the except block of code
Comments
Leave a comment