内容简介:fileno() 方法返回一个整型的文件描述符(file descriptor FD 整型),可用于底层操作系统的 I/O 操作。
概述
fileno() 方法返回一个整型的文件描述符(file descriptor FD 整型),可用于底层操作系统的 I/O 操作。
语法
fileno() 方法语法如下:
fileObject.fileno();
参数
- 无
返回值
返回文件描述符。
实例
以下实例演示了 fileno() 方法的使用:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 打开文件
fo = open("codercto.txt", "wb")
print "文件名为: ", fo.name
fid = fo.fileno()
print "文件描述符为: ", fid
# 关闭文件
fo.close()以上实例输出结果为:
文件名为: codercto.txt 文件描述符为: 3
以上所述就是小编给大家介绍的《Python File fileno() 方法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Pro CSS and HTML Design Patterns
Michael Bowers / Apress / April 23, 2007 / $44.99
Design patterns have been used with great success in software programming. They improve productivity, creativity, and efficiency in web design and development, and they reduce code bloat and complexit......一起来看看 《Pro CSS and HTML Design Patterns》 这本书的介绍吧!