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

Say you have a std::list of some class. There are two ways you can
I have three lists that I want to convert into one list. When I
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
i have two lists: mylist1=[['a','1'],['a',''],['a','1'],['a','3'],['b','2'],['c','2'],['c','3'],['c',''],['c','2']] and mylist2=[['a','1','lemon'],['a','2','coconut'],['a','3','chocolate'],['a','4','watermelon'],['b','1','mango'],['b','2','apple'],['b','3','tree'],['b','4','apple'],['c','1','water'],['c','2','fire'],['c','3','mountain']] I want to find out those lists
I have two files which both contain a list of words. Is there an
I have three lists of lists, and I'm trying to write a generator function
Suppose I have three lists: list1 = a, c, d, r, t list2 =
So I currently have three unordered lists in my header. This is a single-page

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.