Python Forum
[split] Why is there an output of None
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Why is there an output of None
#1
hi
I have a small question, but I did not know if i must open a new thread for it or not, so I ask here:
in the below code :
class Request:
    def send(self):
        print('Sent')

        
http_request=Request()
print(http_request.send())
after running in idle, the output is:
Output:
Sent None
what is this None and what is the reason for it?
I think the output must be send only.
thanks
Reply
#2
None is an object that signifies no value. None is returned by functions/methods that don't have a "return" statement. Request.send() does not have a return statement, so it returns None. Your program prints the return value of http_request.send(), so it prints "None".
akbarza likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to "tee" (=split) output to screen and into file? pstein 6 1,409 Jun-24-2023, 08:00 AM
Last Post: Gribouillis
  How do I split the output? AnunnakiKungFu 2 1,798 Feb-25-2021, 11:13 PM
Last Post: AnunnakiKungFu
  How to Split Output Audio on Text to Speech Code Base12 2 6,876 Aug-29-2020, 03:23 AM
Last Post: Base12
  [split] No Error, and No Output vishal2894 1 1,720 Jul-02-2019, 03:20 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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