Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
Disabled
×
Change Orientation
#The try block will raise an error when trying to write to a read-only file: try: f = open("demofile.txt") f.write("Lorum Ipsum") except: print("Something went wrong when writing to the file") finally: f.close() #The program can continue, without leaving the file object open
Something went wrong when writing to the file
×
Report a Problem:
Your E-mail:
Page address:
Description:
Disabled