Sep-29-2017, 09:27 PM
spla, splb
creates a two element tuple, and is the same as: (spla, splb)
. Which means your for loop would iterate just twice, once for the first list, and once for the second list. The first time, the element is ("a", "b", "c")
, and the second time it'd be ("1", "2", "3")
. You get that error because that's three items, and you're trying to unpack to just two variables.zip gets around this by interleaving the iterables together, to create a single iterable of combined elements, which looks like what you were expecting the for loop to do.