求解释个程序
#!/usr/bin/python
# Filename: lambda.py
def make_repeater(n):
return lambda s: s*n
twice = make_repeater(2)
print twice('word')
print twice(5)
[解决办法]
>>> 'word'*2
'wordword'
发布时间: 2013-04-09 16:45:09 作者: rapoo
求解释个程序
#!/usr/bin/python
# Filename: lambda.py
def make_repeater(n):
return lambda s: s*n
twice = make_repeater(2)
print twice('word')
print twice(5)
>>> 'word'*2
'wordword'