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()方法相关推荐

  1. python 示例_带有示例的Python File write()方法

    python 示例 文件write()方法 (File write() Method) write() method is an inbuilt method in Python, it is use ...

  2. python 示例_带有示例的Python File close()方法

    python 示例 文件close()方法 (File close() Method) close() method is an inbuilt method in Python, it is use ...

  3. python 示例_带有示例的Python File read()方法

    python 示例 文件read()方法 (File read() Method) read() method is an inbuilt method in Python, it is used t ...

  4. flush python_带有示例的Python File flush()方法

    flush python 文件flush()方法 (File flush() Method) flush() method is an inbuilt method in Python, it is ...

  5. 带有示例的Python File readlines()方法

    文件readlines()方法 (File readlines() Method) readlines() method is an inbuilt method in Python, it is u ...

  6. 带有示例的Python File readline()方法

    文件readline()方法 (File readline() Method) readline() method is an inbuilt method in Python, it is used ...

  7. file.fileno_带有示例的Python File fileno()方法

    file.fileno 文件fileno()方法 (File fileno() Method) fileno() method is an inbuilt method in Python, it i ...

  8. Python File(文件) 方法

    Python File(文件) 方法 open() 方法 Python open() 方法用于打开一个文件,并返回文件对象,在对文件进行处理过程都需要使用到这个函数,如果该文件无法被打开,会抛出 OS ...

  9. python File write()方法

    参考文章1:Python File write() 方法 参考文章2:Python中文件的读取和写入操作 参考文章3:python File open()方法

最新文章

  1. Keras还是TensorFlow?深度学习框架选型实操分享
  2. wifi信息修改插件ios_这21款Android Studio插件,你不得不装
  3. Java入门超简单程序Song List
  4. 【转】分布式websocket服务器
  5. decimal转为string sql_PHP+Mysql防止SQL注入的方法
  6. linux中打开gif图片命令,在Linux终端中安装使用Gifski创建GIF动图
  7. leetcode每日一题:406.queue-reconstruction-by-height(根据升高重建队列)
  8. 转眼人到中年:前端老程序员无法忘怀的一次百度电话面试(二)
  9. 2021 年 Web 开发的 7 大趋势,我只能说牛逼!
  10. 随机生成姓名,姓名生成器
  11. 流量转发的思路-软件流量转发 管家婆 客户端 端口 更改
  12. mi5splus android9,小米5SPlus lineage16 安卓9.0 极致省电 纯净 完美root Xposed 经典版
  13. linux添加雅黑字体,linux安装微软雅黑等字体
  14. 设置idea的ant工具的代理
  15. ipad2优酷在线看视频卡死解决方法
  16. 花一样的数据可视化分析工具汇总,你选谁
  17. 数据库系统概论第五版第二章习题6(SPJ数据库查询操作)
  18. 为什么单片机只有可以整除8的特殊寄存器能够位寻址?
  19. 2020英语计算机统考成绩多久出来,网络教育2020年12月统考成绩查询时间已经公布:1月24日...
  20. 手把手教你webpack3(14)HMR模块热加载

热门文章

  1. angular 数字逗号分隔_angular 实现的输入框数字千分位及保留几位小数点功能示例...
  2. 单片机备用电池供电电路_第五节(重排) 电子入门 复位电路
  3. vue 开发过程中遇到的问题
  4. SpringBoot 参数符号转义,用这个包下面的类
  5. linux里面三剑客的重要作用
  6. 什么情况使用 weak 关键字,相比 assign 有什么不同?
  7. eclipse 下使用git clone
  8. 通过ifrmae异步下载文档
  9. Java访问权限的范围
  10. Jade之Extends