home

python os.open()和open()

os.open()返回为打开文件的描述符

f = os.open("test2.py", os.O_NONBLOCK)
print f # 结果为3

 

open()返回为文件对象

f = open("test.log", "wb")
print f # 结果为<open file 'test.log', mode 'wb' at 0x0000000002835030>

详细介绍open():http://www.runoob.com/python/python-func-open.html
posted @ 2018-11-20 17:59  颜舞撩扰  阅读(5004)  评论(0编辑  收藏  举报
footer