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

  • Home
  • SEARCH
  • 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 8410949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:18:46+00:00 2026-06-10T00:18:46+00:00

Suppose I have 3 lists such as these l1 = [1,2,3] l2 = [4,5,6]

  • 0

Suppose I have 3 lists such as these

l1 = [1,2,3]
l2 = [4,5,6]
l3 = [7,8,9]

how do I get to print out everything from these lists at the same time ?
What’s the pythonic way to do something like that ?

for f in l1,l2 and l3:
    print f 

This only seems to be taking 2 lists into account.

Desired output: for each element in all the lists, I’m printing them out using a different function

def print_row(filename, status, Binary_Type):
    print " %-45s %-15s %25s " % (filename, status, Binary_Type)

and I Call the above function inside the for loop.

  • 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-10T00:18:47+00:00Added an answer on June 10, 2026 at 12:18 am

    I think you might want zip:

    for x,y,z in zip(l1,l2,l3):
        print x,y,z  #1 4 7
                     #2 5 8
                     #3 6 9
    

    What you’re doing:

    for f in l1,l2 and l3:
    

    is a little strange. It is basically equivalent to for f in (l1,l3): since l2 and l3 returns l3 (assuming that l2 and l3 are both non-empty — Otherwise, it will return the empty one.)

    If you just want to print each list consecutively, you can do:

    for lst in (l1,l2,l3):  #parenthesis unnecessary, but I like them...
        print lst   #[ 1, 2, 3 ]
                    #[ 4, 5, 6 ]
                    #[ 7, 8, 9 ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an ArrayList<Fruit> I would like to get all elements from this
Suppose I have an IEnumerable such as a List(TValue) and I want to keep
Suppose that you have a function f: List a -> a such that f
Suppose I have two lists that holds the list of source file names and
Suppose I have three lists: list1 = a, c, d, r, t list2 =
Suppose I have two differently-sized lists a = [1, 2, 3] b = ['a',
Does python have immutable lists? Suppose I wish to have the functionality of an
Suppose I have a list (or Set): List<String> testList = Lists.newArrayList(assocX,srcT,destA,srcX, don't care Y,
I have a DAG representing a list of properties. These properties are such that
In Java, suppose I have a method that takes in two lists of integers,

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.