讲解Python中fileno()方法的使用
作者:goldensun 时间:2022-06-28 06:16:12
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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
VBScript运行出错信息涵义列表
2007-08-12 18:03:00
有感用户体验规划与系统实现
2009-11-27 18:33:00
![](https://img.aspxhome.com/file/UploadPic/200911/27/01-48s.jpg)
用 Schema 约束 XML 数据
2010-08-24 18:21:00
![](https://img.aspxhome.com/file/UploadPic/20108/24/20100814231755976-28s.gif)
JavaScript中的"类" 序言
2008-02-18 13:26:00
使用Python自动化Microsoft Excel和Word的操作方法
2023-04-11 16:15:21
![](https://img.aspxhome.com/file/2023/3/75953_0s.png)
Python数据类型学习笔记
2023-02-09 13:42:39
![](https://img.aspxhome.com/file/2023/6/86436_0s.png)
如何让对方在线查看我的程序代码?
2010-05-13 16:34:00
oracle数据库导入导出命令使用方法
2023-07-22 19:06:39
使用python3+xlrd解析Excel的实例
2021-05-09 23:37:33
Python 新建文件夹与复制文件夹内所有内容的方法
2022-03-22 00:05:05
Pycharm及python安装详细教程(图解)
2023-01-06 00:26:00
![](https://img.aspxhome.com/file/2023/6/75266_0s.jpg)
Python入门Anaconda和Pycharm的安装和配置详解
2022-12-21 20:25:07
![](https://img.aspxhome.com/file/2023/5/82925_0s.png)
Django--权限Permissions的例子
2021-02-16 01:44:51
两个asp函数实现javascript的escape函数和unescape函数功能
2009-02-04 15:47:00
Python中matplotlib库安装失败的经验总结(附pycharm配置anaconda)
2021-01-04 21:42:14
![](https://img.aspxhome.com/file/2023/6/81836_0s.png)
高性能PHP框架Symfony2经典入门教程
2023-11-16 02:39:23
Bootstrap实现渐变顶部固定自适应导航栏
2023-08-23 00:52:40
![](https://img.aspxhome.com/file/2023/8/56078_0s.png)
在PHP程序中运行Python脚本(接收数据及传参)的方法详解
2023-11-24 10:14:48
![](https://img.aspxhome.com/file/2023/0/108110_0s.png)
python 利用panda 实现列联表(交叉表)
2022-02-21 02:24:32
![](https://img.aspxhome.com/file/2023/0/68990_0s.jpg)
Python3如何在Windows和Linux上打包
2021-04-24 13:50:50
![](https://img.aspxhome.com/file/2023/2/70672_0s.jpg)