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 6470503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:07:07+00:00 2026-05-25T06:07:07+00:00

Is it possible to perform multiple loops simultaneously in python. Like(syntax error, of course):

  • 0

Is it possible to perform multiple loops simultaneously in python.

Like(syntax error, of course):

for a,b in list_of_a,list_of_b:
      //do some thing

By simultaneously, I am not meaning the thread or process sense.

I mean, they share the same index or cursor during the iteration.

What I can think of achieving that is:

  1. Use a int variable to act as a shared cursor
  2. put them in a list of tuples and iterate the tuple-list. But creating the list is laborious

I am just wondering if there some built-in functions or simpler syntax to achieve that.

  • 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-05-25T06:07:08+00:00Added an answer on May 25, 2026 at 6:07 am
    for a,b in zip(list_of_a, list_of_b):
      # Do some thing
    

    If you’re using Python 2.x, are worried about performance, and/or using iterators instead of lists, consider itertools.izip instead of zip.

    In Python 3.x, zip replaces itertools.izip; use list(zip(..)) to get the old (2.x) behavior of zip returning a list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it even possible to perform address (physical, not e-mail) validation? It seems like
Is it possible to perform a named-group match in Perl's regex syntax as with
Is it possible to use a jQuery ajax call to perform Forms Authentication with
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
I have two tables on different servers, and I'd like some help finding an
I'd like to extract a date from any string entered. But not specific to
Is it possible to perform a subquery on a QuerySet using another QuerySet? For
I'm a bit new to .net so i was wondering if a thing like
Basically what I would like to do is run multiple (15-25) regex replaces on
I'm looking into buying an Android phone and I'd like to do some development

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.