Python file fileno()返回整数文件描述符,基础实现使用该描述符从操作系统请求I/O操作。
fileObject.fileno();
此方法返回整数文件描述符。
以下示例显示了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()
当无涯教程运行上面的程序时,它产生以下输出-
链接:https://www.learnfk.comhttps://www.learnfk.com/python/file-fileno.html
来源:LearnFk无涯教程网
Name of the file: foo.txt File Descriptor: 3
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)