Python 3.x “为什么?”;str(打印(“你好”)和“一”;印刷品;“你好,非一号”;用python?

Python 3.x “为什么?”;str(打印(“你好”)和“一”;印刷品;“你好,非一号”;用python?,python-3.x,Python 3.x,我希望它会像我写“str(print())+“one”时那样打印“helloone”,输出是“Noneone”,因为“print()”是None。所以如果我把“str(print)(“hello”)+“one”放在“str(print”(“hello”)+“one”上,那么它会加上“hello”和“one”,应该打印“helloone”,但当你像这样打印“hello”时,它会输出“hello Noneone”。 print("hello") 它正在打印文本hello,命令完成。因此,它

我希望它会像我写“str(print())+“one”时那样打印“helloone”,输出是“Noneone”,因为“print()”是None。所以如果我把“str(print)(“hello”)+“one”放在“str(print”(“hello”)+“one”上,那么它会加上“hello”和“one”,应该打印“helloone”,但当你像这样打印“hello”时,它会输出“hello Noneone”。

    print("hello")

它正在打印文本hello,命令完成。因此,它返回一个非类型值,即None。然后将该值转换为字符串并变为“None”,然后将其添加到“one”中,该值将为您提供“Noneone”

它提供此输出,因为它打印hello,然后打印返回None,然后再次显示(在REPL中)。Print不会返回它所打印的内容,而是返回
None

您确定
Print(“hello”)+“one”
会打印
hello noneone
?不,很抱歉,[str(Print(“hello”)+“one”]