Utils.cycle(values)

Creates a function that returns the next value of an array every time it's called.
译:创建一个函数,它每次调用时返回一个数组的下一个值。

Arguments(参数)

values — An array of values. 译:数组的值。

cycler = Utils.cycle(["a", "b", "c"])

print cycler() # Output: "a" 
print cycler() # Output: "b" 
print cycler() # Output: "c" 
print cycler() # Output: "a", returns to start

results matching ""

    No results matching ""