好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Python引用传值概念的示例详解

这篇文章主要介绍了Python引用传值概念与用法,简单分析了Python引用传值的概念、功能并结合实例形式总结分析了Python引用传值的具体实现与使用方法,需要的朋友可以参考下

# 添加了一个string类型的元素添加到末尾
def ChangeList(lis):
  lis.append('hello i am the addone')
  print lis
  return
lis = [1, 2, 3]
ChangeList(lis)
print lis 
[1,2,3, 'hello i am the addone']
[1,2, 3,'hello i am the addone'] 
def ChangeString(string):
  string = 'i changed as this'
  print string
  return
string = 'hello world'
ChangeString(string)
print string 
i changed as this
hello world 

以上就是Python引用传值概念的示例详解的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于Python引用传值概念的示例详解的详细内容...

  阅读:43次