python必備內置函數-open(file)

阿裏雲問答 2022-01-07 05:17:41 阅读数:378

python open file

python必備內置函數-open(file)




采納答案1:

import io

io.open()

open()

都可以




采納答案2:

返回文件對象

In [146]: fo = open('D:/a.txt',mode='r', encoding='utf-8')In [147]: fo.read()Out[147]: '\ufefflife is not so long,\nI use Python to play.'

mode取值錶:

1.PNG


版权声明:本文为[阿裏雲問答]所创,转载请带上原文链接,感谢。 https://gsmany.com/2022/01/202201070517407335.html