形参和实参|默认值|可选实参|tuple|*tuple|args|*args | **kwargs|args[:]|

时间:2023-03-09 00:18:48
形参和实参|默认值|可选实参|tuple|*tuple|args|*args | **kwargs|args[:]|
 #!/usr/bin/python

 def hello(i,greet='long time to see!'):
out = "hello "+i+" "+greet
nobody = {'as':'','ad':'','om':'ssss'}
if i == '':return nobody
return out name = 'we'
if hello('we')==hello(name)and hello('we')==hello(i= 'we'):
print "right!" #right! yoo = hello('ss','yoooo!')
print yoo #hello ss yoooo! for key in hello('','yoooo!').items():
print key
'''
('om', 'ssss')
('as', '123')
('ad', '1234')
'''
l = hello('')
print l l_1 = hello('')
l_2 = hello('')
print l_1
def printnumber(**arr):
for i in arr.values():
print i def pr(arr):
for i in arr.keys():
print i printnumber(a='alala',b='bababa',c= 'sksks')
pr(l_1)
'''
alala
sksks
bababa
''' a = [1,2,3,4]
b = ['a','b','c','d']
c = [a[:],b[:]] def cut(*a_1):
for i in a_1:
del i[1]
return a_1 print cut(c[:])
print a,b
print cut(a[:],b[:]) '''
([[1, 2, 3, 4]],)
[1, 2, 3, 4] ['a', 'b', 'c', 'd']
([1, 3, 4], ['a', 'c', 'd'])
'''