what is meaning of [iter(list)]*2 in python?
问题 I have found below code in web, result is tuple of two elements in list, how to understand [iter(list)]*2 ? lst = [1,2,3,4,5,6,7,8] b=zip(*[iter(lst)]*2) list(b) [(1, 2), (3, 4), (5, 6), (7, 8)] ------------ [iter(lst)]*2 [<list_iterator at 0x1aff33917f0>, <list_iterator at 0x1aff33917f0>] I check [iter(lst)]*2 , same iterator above, so meaning iter repeat double, so, if i check num from 2 to 3, result should be [(1, 2, 3), (4, 5, 6),(7,8,NaN)] but delete 7,8 lst = [1,2,3,4,5,6,7,8] b=zip(*