Python3 function return, python3 function return

Source: Internet
Author: User

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 '''

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.