Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:14:42+00:00 2026-06-10T21:14:42+00:00

This is probably a beginners question but I don’t know how to search for

  • 0

This is probably a beginners question but I don’t know how to search for an answer (because I cannot “name” the question)

I have 2 lists or a tuple of 2 lists

xxx = ["time1", "time2", "time3"]
yyy = ["value1", "value2", "value3"]
zzz=(xxx,yyy)

now I would like to create a list/tuple for every entry
result should be

[['time1', 'value1'], ['time2', 'value2'], ['time3', 'value3']]

I’m able to do this with a for loop (and zip) but is there no “nicer” solution?
Here is a similar question but I’m not able to use the resolution given there for my probelms

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:14:44+00:00Added an answer on June 10, 2026 at 9:14 pm

    Use the builtin zip function:

     zzz = zip(xxx, yyy) 
    

    Of course, this creates a list of tuples (or an iterable of tuples in python3.x). If you really want a list of lists:

     #list (python2.x) or iterable(python3.x) of lists
     zzz = map(list,zip(xxx,yyy)) 
    

    or

     #list of lists, not list of tuples
     #python 2.x and python 3.x
     zzz = [ list(x) for x in zip(xxx,yyy) ]
    

    If you’re using python3.x and you want to make sure that zzz is a list, the list comprehsion solution will work, or you can construct a list from the iterable that zip produces:

    #list of tuples in python3.x.  
    zzz = list(zip(xxx,yyy)) #equivalent to zip(xxx,yyy) in python2.x
                             #will work in python2.x, but will make an extra copy.
                             # which will be available for garbage collection
                             # immediately
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

probably this is a real beginner question, but i cannot find an answer on
This probably is a dummy question but I cannot find a clear indication. I
This is probably a beginner question, but I've already tried looking for an answer
Ok so this is probably a very beginner question but... Right now I have
I realize that this is probably a very basic question, but I have spent
I know this question is probably very basic, but I am a beginner so
I know this probably really simple but Im not sure what im doing wrong...
I know this probably has been asked before but I am having issues with
Im sorry for this probably dumm question, but I want to simply open modals
I'm working on an iphone app but this is probably a general question. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.