python 函数参数 函数工具
2022-04-05 16:57 jym蒟蒻 阅读(39) 评论(0) 编辑 收藏 举报文章目录
- python函数之参数
- python的lambda表达式:
- 函数工具:map,filter,reduce
>>> def f(a):
a=99
>>> b=88
>>> f(b)
>>> print(b)
88
>>> def ch(a,b):
a=2
b[0]='eoe'
>>> x=1
>>> l=[1,2]
>>> ch(x,l)
>>> x,l
(1, ['eoe', 2])
>>> x=1
>>> a=x
>>> a=2
>>> print(x)
1
>>> l=[1,2]
>>> b=l
>>> b[0]='eoe'
>>> print(l)
['eoe', 2]
>>> l=[1,2]
>>> ch(x,l[:])
>>> l
[1, 2]
>>> l1=[2,3,4]
>>> l2=l1
>>> l1[0]=24
>>> l1,l2
([24, 3, 4], [24, 3, 4])
>>> l1=[2,3,4]
>>> l2=l1[:]
>>> l1[0]=24
>>> l1,l2
([24, 3, 4], [2, 3, 4])
>>> def ch(a,b):
b=b[:]
a=2
b[0]='cho'
>>> x=1
>>> l=[