Python Function Returning None

后端 未结 5 2027
一整个雨季
一整个雨季 2020-11-22 08:12

My very simple python function is returning \'None\' at the end of it and I\'m not sure quite why. I\'ve looked at some other posts and still can\'t figure it out. Any help

5条回答
  •  温柔的废话
    2020-11-22 08:52

    I came from Ruby as well and it seems strange at first.

    If you print something that has a print statement in it, the last thing it returns is None.

    If you just returned the values and then invoked a print on the function it would not output None.

    Hope this helps :)

提交回复
热议问题