后悔
今天我在小甲鱼的课程上跟着用while循环模拟for循环:>>> x =
>>> _ = iter(x)
>>> while True:
try:
i = _.__next__()
except StopIteration:
break
print(i,end=' ')
1 1 2 3 5
但第三段代码的第三行我少写了一对括号:
>>> while True:
try:
i = _.__next__
except StopIteration:
break
print(i,end=' ')
然后,我看到了神奇的一幕:
>>> while True:
try:
i = _.__next__
except StopIteration:
break
print(i,end=' ')
<method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__next__' of list_iterator object at 0x0120B2E0> <method-wrapper '__nex......
我呆了十几秒才反应过来用 Ctrl + C 强制暂停,以至于我的电脑出现了11483行代码!{:10_247:}
不怕电脑去世的可以去试试
我后悔升级 Windows11 没逝啊
页:
[1]