【问题标题】:What is flush in print function? [duplicate]什么是打印功能中的冲洗? [复制]
【发布时间】:2020-05-03 03:17:41
【问题描述】:

python中print函数中的flush是什么?如果设置为 True 会发生什么?在什么情况下设置它 True 有帮助?请提供好的例子来理解。 print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

【问题讨论】:

    标签: python printing flush


    【解决方案1】:

    它强制print 的输出到屏幕上。在 python 3 中而不是这样做:

    import sys
    sys.stdout.flush()
    

    您可以使用flush。 更多详情请关注here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-27
      • 2016-12-20
      • 2018-05-23
      • 2014-04-13
      • 2013-01-02
      • 2017-12-04
      • 2020-01-29
      • 1970-01-01
      相关资源
      最近更新 更多