获取您自己的
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")
写入文件时出现错误