Python Forum
join elements from two splits
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
join elements from two splits
#3
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.
Reply


Messages In This Thread
join elements from two splits - by dwiga - Sep-08-2017, 03:24 AM
RE: join elements from two splits - by wavic - Sep-08-2017, 06:55 AM
RE: join elements from two splits - by nilamo - Sep-29-2017, 09:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  String Splits m.zod 3 6,259 Oct-05-2016, 08:14 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020