獲取您自己的 Python 伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
#The try block will raise an error when trying to write to a read-only file: try: f = open("demofile.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")
寫入檔案時出錯