zoukankan      html  css  js  c++  java
  • 函数的返回值

    # _*_ coding: utf-8 _*_

    # return 值:

    # 注意点:

    # 1. 函数额返回值没有类型限制
    # 2. 函数的返回值没有个数限制
    # 2.1 返回多个值:多个返回值用逗号分隔开,返回的是元组形式
    # def function():
    # print('from function')
    # return 1,2.1,'hello',[1,2,3],(2,3)
    # res = function()
    # print(res,type(res))
    # #from function
    # #(1, 2.1, 'hello', [1, 2, 3], (2, 3)) <class 'tuple'>

    # 2.2 返回1个值:返回的就是该值本身
    # def function1():
    # return 123
    # res = function1()
    # print(res,type(res))
    # #123 <class 'int'>

    # 2.3 返回0个值或者干脆没有返回值
    # return:None
    # def function2():
    # pass
    # res = function2()
    # print(res)
    # # None
    #
    # def function3():
    # return
    # res = function3()
    # print(res)
    # #None
  • 相关阅读:
    $.getJSON()
    seconds
    ini_set
    validation
    component
    ini_set();
    长期阅读英文技术博客的好处
    用xml还是json
    单​手​打​字
    洛谷P1141 01迷宫
  • 原文地址:https://www.cnblogs.com/OutOfControl/p/9703024.html
Copyright © 2011-2022 走看看