Python3 function return, python3 function return
1 # def logger (): 2 # f = open ("loge.txt", "a") 3 # f. write ("2017-09-15 exec function") 4 # f. close () 5 # print ("2017-09-15 exec function") 6 #7 # print ("------------------") 8 #9 # Return Value 10 # def f (): 11 # print ('OK') 12 #13 # return 11 # Who to return 14 # print (123) #15 # a = f () is not executed () 16 ''' 17 returns None by default. If an object 18 is returned, the returned value is assigned to a19. end function, 2. returns a 20''' 21 22 # def add (* args): 23 # print (args) 24 # Sum = 025 # for I in args: 26 # Sum + = i27 # print (Sum) 28 # return Sum29 #30 # a = add (1, 2) 31 # print (a) 32 #33 # def foo (): 34 # return 3, '123', [123] 35 #36 # B = foo () 37 # print (B) 38 39 ''' 40 1. if the function does not return, None41 2 is returned by default. if multiple objects are returned, Python will encapsulate these objects into a single tuple. In fact, the returned object is also 42 '''