# 当尝试写入只读文件时,try 代码块会引发错误:
try:
f = open("../demo/python/demofile-onlyread.txt")
try:
f.write("Lorum Ipsum")
except:
print("Something went wrong when writing to the file")
finally:
f.close()
except:
print("Something went wrong when opening the file")