Python Forum
Take first Elements of sublists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Take first Elements of sublists
#3
list_of_lists = [[1, 2], [3, 4]]
print(list(zip(*list_of_lists)))
Output:
[(1, 3), (2, 4)]
quest likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Take first Elements of sublists - by quest - Apr-26-2021, 11:15 AM
RE: Take first Elements of sublists - by perfringo - Apr-26-2021, 11:31 AM
RE: Take first Elements of sublists - by buran - Apr-26-2021, 11:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List of lists - merge sublists with common elements medatib531 1 1,416 May-09-2021, 07:49 AM
Last Post: Gribouillis
  Sorting Elements via parameters pointing to those elements. rpalmer 3 1,136 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  Flatten list sublists chesschaser 8 1,430 Jul-07-2020, 11:38 AM
Last Post: chesschaser
  Converting list elements and sublists from int to str iMuny 5 3,062 Mar-10-2019, 09:05 PM
Last Post: iMuny

Forum Jump:

User Panel Messages

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