python-3.x - 为什么我会收到此错误 OSError: [Errno 9] Bad file descriptor?使用 f.close() 关闭文件时发生
问题描述
在关闭文件时,我得到了这个 OSError。谁能解释出了什么问题?
>>> f=open('fr.txt','w')
>>> print('hey',file=f)
>>> f.close()
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
解决方案
推荐阅读
- charts - 如何在子图之间共享模板值?
- python - Python io.BytesIO 的 write()、read() 和 getvalue() 方法是如何工作的?
- javascript - ApiCurio:如何编辑/更新整个 API 定义对象?
- drupal - Drupal 8:仅当用户有足够的积分时才添加到购物车
- axios - 如何使用 jest 测试 axios 拦截器?
- qt - QIODevice::read (QSerialPort) : 设备未打开
- javascript - 在 WebSocket 握手期间带有 express 和 websocket 的 Node.js 给出错误:意外的响应代码:200
- symfony - Symfony 总是返回拒绝访问,@Security,控制器,isAuthor
- heroku - 带有反应样板的盖茨比
- python - Keras:可以给 lamda 层命名吗?