这段代码是什么意思:"print>>sys.stderr" [英] What does this code mean: "print >> sys.stderr"

查看:34
本文介绍了这段代码是什么意思:"print>>sys.stderr"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

print >> sys.stderr, "Error in atexit._run_exitfuncs:"

为什么要在sys.stderr前打印>>"?

Why print '>>' in front of sys.stderr?

谢谢.

推荐答案

此语法意味着写入文件对象(在本例中为sys.stderr)而不是标准输出.[链接]

This syntax means writes to a file object (sys.stderr in this case) instead of standard output. [Link]

在 Python 3.0 中,print 变成了一个函数而不是一个语句:[链接]

In Python 3.0, print becomes a function instead of a statement: [Link]

print("Error in atexit._run_exitfuncs:", file=sys.stderr)

这篇关于这段代码是什么意思:"print>>sys.stderr"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆