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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:52:46+00:00 2026-05-23T14:52:46+00:00

I have three lists. Two are returned from functions. The other list, list_c ,

  • 0

I have three lists. Two are returned from functions. The other list, list_c, is being created in the program out of some hardcoded options and some variables, and the contents of these lists. This list is a list of arguments to be passed to another program, so the order is important. I need each item in list_a and list_b to be in the middle of list_c in a certain position. Both list_a and list_b are variable in length.

list_a = some_function()
list_b = some_other_function()
list_c = ['some', 'stuff', list_a, 'more', list_b, variables]

Basically, I want something like the above, except giving a flat list instead of a nested list.

I could do:

list_c = ['some', 'stuff']
list_c.extend(list_a)
list_c.append('more')
list_c.extend(list_b)
list_c.append(variables)

but that looks a bit clunky and I was curious if there was a more elegant way to do it.

  • 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-23T14:52:46+00:00Added an answer on May 23, 2026 at 2:52 pm

    How about this? You can append/concatenate lists with +

    ['some', 'stuff'] + some_function() + ['more'] + some_other_function() + [variables]

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

Sidebar

Related Questions

I have this unordered list <ul> <li>two</li> <li>three</li> </ul> Is there a way I
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have a nested list comprising ~30,000 sub-lists, each with three entries, e.g., nested_list
I'm witnessing some strange behaviour from Fluent nHibernate. I have two objects involved in
I have two string lists that I'm working with. One that has a list
Is there any way to list all the files that have changed between two
I have two files which both contain a list of words. Is there an
So I currently have three unordered lists in my header. This is a single-page
I'm completely stumped on this one. I have three different lists that need to
Let's say I have the three following lists A1 A2 A3 B1 B2 C1

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.