关于Python迭代器函数iteration.cycle()的问题

迭代器应该是每次从列表中取出一个元素然后储存在变量中,然后配合next()函数就可以循环提取元素,那么这个问题是怎么回事呢?代码如下:

for x in range(12):
a=itertools.cycle([0,1,2,3])
b=next(a)
print(b)

运行后结果如下:

pygame 2.0.1 (SDL 2.0.14, Python 3.9.5)
Hello from the pygame community. Contribute - pygame wiki https://www.pygame.org/contribute.html
0
0
0
0
0
0
0
0
0
0
0
0

我的疑问是,为什么结果不是(0,1,2,3,0,1,2,3,0,1,2,3)
而全都是第一个元素‘0’呢?

a的赋值要放循环外面

a=itertools.cycle([0,1,2,3])
for x in range(12):
    b=next(a)
    print(b)