简体   繁体   English

Python双重打印功能,我不明白这个例子是如何工作的

[英]Python double print function, I don't understand how this example works

Why does the code?为什么是代码?

print(print("Hello"))

send back to the user.发回给用户。

hello
none

I don't get it.我不明白。

print is function which does return None and have side effect of printing printreturn None并具有打印副作用的函数

print("Hello")

does print Hello and return None so external print does "see" that its' 1st argument is None and print that确实打印Helloreturn None所以外部print确实“看到”它的'第一个参数是None并打印

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM