python中os.open()和open()区别 sany

open() 方法用于打开一个文件,并返回文件对象

os.open() 方法用于打开一个文件,并且设置需要的打开选项,模式参数mode参数是可选的,默认为 0777,返回值是新打开文件的描述符

主要是两者的语法上的mode值不一致,多多看下链接里的语法知识

参考:

https://www.runoob.com/python3/python3-os-open.html

https://www.runoob.com/python3/python3-file-methods.html

原文地址:https://www.cnblogs.com/sanyvaelailai/p/14307142.html