Python学习 补充 iter partial
Posted Sundance8866
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python学习 补充 iter partial相关的知识,希望对你有一定的参考价值。
iter:
def 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__())
partial
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的主要内容,如果未能解决你的问题,请参考以下文章