Why doesn't Python print return values?

后端 未结 4 1787
一个人的身影
一个人的身影 2021-01-22 00:49

I\'m taking a class in Algorithms and Data Structures (Python). In the book there is an example of a \"stack\" with methods that return certain values. In the book, these values

4条回答
  •  孤独总比滥情好
    2021-01-22 01:21

    At the interactive interpreter, Python will print the repr of expression values (except None) as a convenience. In a script, you have to print manually, as automatic printing would be highly awkward to work around in a script.

提交回复
热议问题