Python3 函數return,python3函數return

來源:互聯網
上載者:User

Python3 函數return,python3函數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 # # 傳回值10 # def f():11 #     print('OK')12 # 13 #     return 11     # 返回什麼內容給誰14 #     print(123)     # 不會執行15 # a = f()16 '''17 預設返回None,返回一個對象18 將返回的值賦給a19 作用:1.結束函數,2.返回某個對象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',[3,2]35 # 36 # b = foo()37 # print(b)38 39 '''40 1.函數如果沒有return,預設返回None41 2.如果return多個對象,那麼Python會幫我們把這多個對象封裝成一個元組,其實返回的也是一個對象42 '''

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.