1.读写文件: 写一个文本文件text:内容为西安培华学院 with open('homework', 'w', encoding='UTF-8') as file_obj: file_obj.write('西安培华学院') 截图: 读取文本文件的内容 with open('homework', 'r', encoding='UTF-8') as file_obj: data = file_obj.read() print(data