手机
当前位置:查字典教程网 >脚本专栏 >python >讲解Python中fileno()方法的使用
讲解Python中fileno()方法的使用
摘要:fileno()方法返回所使用的底层实现,要求从操作系统I/O操作的整数文件描述符。语法以下是fileno()方法的语法:fileObjec...

fileno()方法返回所使用的底层实现,要求从操作系统I/O操作的整数文件描述符。

语法

以下是fileno()方法的语法:

fileObject.fileno();

参数

NA

返回值

此方法返回整数文件描述符。

例子

下面的例子显示fileno()方法的使用。

#!/usr/bin/python # Open a file fo = open("foo.txt", "wb") print "Name of the file: ", fo.name fid = fo.fileno() print "File Descriptor: ", fid # Close opend file fo.close()

当我们运行上面的程序,它会产生以下结果:

Name of the file: foo.txt File Descriptor: 3

【讲解Python中fileno()方法的使用】相关文章:

详解Python中的__init__和__new__

Python urlopen 使用小示例

Python的一些用法分享

Python中文编码那些事

Python 元类使用说明

Python的print用法示例

python中mechanize库的简单使用示例

Python正则表达式的使用范例详解

Python程序设计入门(3)数组的使用

Python的函数嵌套的使用方法

精品推荐
分类导航