isatty_带有示例的Python File isatty()方法
isatty
文件isatty()方法 (File isatty() Method)
isatty() method is an inbuilt method in Python, it is used to check whether a file stream is an interactive or not in Python i.e. a file stream is connected to a terminal device. If a file is connected to a terminal then it will be an interactive and the method will return "True".
isatty()方法是Python中的内置方法,用于检查文件流在Python中是否是交互式的,即文件流已连接到终端设备。 如果文件连接到终端,则它将是交互式的,并且该方法将返回“ True”。
Syntax:
句法:
file_object.isatty()
Parameter(s):
参数:
It does not accept any parameter.
它不接受任何参数。
Return value:
返回值:
The return type of this method is <class 'bool'>, it returns True if file stream is an interactive and returns False if files is not interactive.
此方法的返回类型为<class'bool'> ,如果文件流是交互式的,则返回True;如果文件不是交互式的,则返回False 。
Example:
例:
# Python File isatty() Method with Example
# creating a file
myfile1 = open("hello1.txt", "w")
# checking whethet the file stream is
# an interactive
print("myfile1.isatty():", myfile1.isatty())
# closing the file
myfile1.close()
# opening file in read mode
myfile1 = open("hello1.txt", "r")
# checking whethet the file stream is
# an interactive
print("myfile1.isatty():", myfile1.isatty())
# closing the file
myfile1.close()
Output
输出量
myfile1.isatty(): False
myfile1.isatty(): False
翻译自: https://www.includehelp.com/python/file-isatty-method-with-example.aspx
isatty
isatty_带有示例的Python File isatty()方法相关推荐
- python 示例_带有示例的Python File write()方法
python 示例 文件write()方法 (File write() Method) write() method is an inbuilt method in Python, it is use ...
- python 示例_带有示例的Python File close()方法
python 示例 文件close()方法 (File close() Method) close() method is an inbuilt method in Python, it is use ...
- python 示例_带有示例的Python File read()方法
python 示例 文件read()方法 (File read() Method) read() method is an inbuilt method in Python, it is used t ...
- flush python_带有示例的Python File flush()方法
flush python 文件flush()方法 (File flush() Method) flush() method is an inbuilt method in Python, it is ...
- 带有示例的Python File readlines()方法
文件readlines()方法 (File readlines() Method) readlines() method is an inbuilt method in Python, it is u ...
- 带有示例的Python File readline()方法
文件readline()方法 (File readline() Method) readline() method is an inbuilt method in Python, it is used ...
- file.fileno_带有示例的Python File fileno()方法
file.fileno 文件fileno()方法 (File fileno() Method) fileno() method is an inbuilt method in Python, it i ...
- Python File(文件) 方法
Python File(文件) 方法 open() 方法 Python open() 方法用于打开一个文件,并返回文件对象,在对文件进行处理过程都需要使用到这个函数,如果该文件无法被打开,会抛出 OS ...
- python File write()方法
参考文章1:Python File write() 方法 参考文章2:Python中文件的读取和写入操作 参考文章3:python File open()方法
最新文章
- Keras还是TensorFlow?深度学习框架选型实操分享
- wifi信息修改插件ios_这21款Android Studio插件,你不得不装
- Java入门超简单程序Song List
- 【转】分布式websocket服务器
- decimal转为string sql_PHP+Mysql防止SQL注入的方法
- linux中打开gif图片命令,在Linux终端中安装使用Gifski创建GIF动图
- leetcode每日一题:406.queue-reconstruction-by-height(根据升高重建队列)
- 转眼人到中年:前端老程序员无法忘怀的一次百度电话面试(二)
- 2021 年 Web 开发的 7 大趋势,我只能说牛逼!
- 随机生成姓名,姓名生成器
- 流量转发的思路-软件流量转发 管家婆 客户端 端口 更改
- mi5splus android9,小米5SPlus lineage16 安卓9.0 极致省电 纯净 完美root Xposed 经典版
- linux添加雅黑字体,linux安装微软雅黑等字体
- 设置idea的ant工具的代理
- ipad2优酷在线看视频卡死解决方法
- 花一样的数据可视化分析工具汇总,你选谁
- 数据库系统概论第五版第二章习题6(SPJ数据库查询操作)
- 为什么单片机只有可以整除8的特殊寄存器能够位寻址?
- 2020英语计算机统考成绩多久出来,网络教育2020年12月统考成绩查询时间已经公布:1月24日...
- 手把手教你webpack3(14)HMR模块热加载