builtins.open库
时间: 2023-07-21 13:43:06
浏览: 64
`builtins.open`是Python[内置](https://geek.csdn.net/educolumn/3ab6c130815e287f3c961c21cf111c40?spm=1055.2569.3001.10083)的一个[[函数](https://geek.csdn.net/educolumn/2319d2a62911adc34b96ea572d8225a2?spm=1055.2569.3001.10083)](https://geek.csdn.net/educolumn/ba94496e6cfa8630df5d047358ad9719?dp_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NDQ0MDg2MiwiZXhwIjoxNzA3MzcxOTM4LCJpYXQiOjE3MDY3NjcxMzgsInVzZXJuYW1lIjoid2VpeGluXzY4NjQ1NjQ1In0.RrTYEnMNYPC7AQdoij4SBb0kKEgHoyvF-bZOG2eGQvc&spm=1055.2569.3001.10083),用于打开文件并返回一个文件[对象](https://geek.csdn.net/educolumn/04c51611e4b730957464192e0307b82c?spm=1055.2569.3001.10083)。它的语法如下:
```python
open(file, mode='r', [buffer](https://geek.csdn.net/educolumn/60b4840c0d25f5114c0cae30358a3db8?spm=1055.2569.3001.10083)ing=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
```