Python Forum
Why does Python Print return None
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does Python Print return None
#4
Quote:>>> print(print("hello"))
hello
None
All functions return None if not returning anything else. And in python3.x print is a function. The inner hello function runs, and prints hello. Then returns...which returns None. So the outer print becomes
Quote:print(None)
Which that print outputs the return value of None.
Recommended Tutorials:
Reply


Messages In This Thread
Why does Python Print return None - by Steven - Mar-19-2017, 12:58 AM
RE: Why does Python Print return None - by Steven - Mar-19-2017, 01:42 AM
RE: Why does Python Print return None - by metulburr - Mar-19-2017, 02:11 AM
RE: Why does Python Print return None - by Steven - Mar-19-2017, 02:12 AM
RE: Why does Python Print return None - by Larz60+ - Mar-19-2017, 06:03 AM
RE: Why does Python Print return None - by nilamo - Mar-19-2017, 05:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Question on "define function"; difference between return and print extricate 10 4,756 Jun-09-2020, 08:56 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020