1. python中返回值的类型,当然还可以组成其他的类型

  tuple

def returnValue(a,b):
    c = a+b
    return (a,b,c)

x,y,z = returnValue(1,2)
print 'x:',x,'y:',y,'z:',z

  list

def returnValue(a,b):
    c = a+b
    return [a,b,c]

x = returnValue(1,2)
print x

  dict

def returnValue(a,b):
    c = a+b
    return {a:c,b:c}

x = returnValue(1,2)
print x

  

相关文章:

  • 2021-08-18
  • 2022-12-23
  • 2021-07-28
  • 2022-02-01
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2021-12-06
  • 2021-06-08
  • 2021-06-15
  • 2022-12-23
相关资源
相似解决方案