Python学习 补充 iter partial
2021-01-16 01:13
标签:next pytho for turn art first add 函数 fun iter: partial Python学习 补充 iter partial 标签:next pytho for turn art first add 函数 fun 原文地址:https://www.cnblogs.com/sundanceS/p/12933526.htmldef iter(source, sentinel=None): # known special case of iter
"""
iter(iterable) -> iterator
iter(callable, sentinel) -> iterator
Get an iterator from an object. In the first form, the argument must
supply its own iterator, or be a sequence.
In the second form, the callable is called until it returns the sentinel.
"""
pass
l=[‘a‘,‘b‘,‘c‘,‘d‘]
def test():
return l.pop()
y=iter(test,‘b‘)
print(y.__next__())
print(y.__next__())
# print(y.__next__())
# print(y.__next__())
from functools import partial
def add(x,y):
return x+y
# print(add(1,5))
#
func=partial(add,8) #偏函数
print(func(1))
print(func(2))
文章标题:Python学习 补充 iter partial
文章链接:http://soscw.com/index.php/essay/42489.html