标签: python itertools
我想要打印此nums列表中存在的所有偶数
from itertools import takewhile nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] a = takewhile(lambda x: x%2==0, nums) print(a)
但输出为<itertools.takewhile object at 0x00C462B0>
<itertools.takewhile object at 0x00C462B0>