2019-04-30 11:13:02 929浏览
def func(): print("yes") func() #运行结果是: yes Process finished with exit code 0
def func(): return "yes" func() #运行结果是: Process finished with exit code 0
def func(): return "yes" f = func() print(f) #运行结果是: yes Process finished with exit code 0
def fun(): print("yes") def fun2(): return "not" def fun3(): pass #保持代码结构规范 fun() print('**********') fun2() print('**********') f = fun() print(f) print('**********') f2 = fun2() print(f2) print('**********') f3 = fun3() print(f3) print('**********') #运行结果: yes #func()的运行结果 ********** ********** #func2()的运行结果 yes #print(f)的运行结果 None ********** not #print(f2)的运行结果 ********** None #print(f3)的运行结果 **********
【关注微信公众号获取更多学习资料】 【扫码进入Python全栈开发免费公开课】