file = open('test.txt', 'w') # 对文件进行操作 file.close()
with open('test.txt', 'w') as file: pass
with open('test.txt', 'w', encoding='utf-8') as file: pass