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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:33:13+00:00 2026-05-30T16:33:13+00:00

How can I increment a list in python.In the following case So that means

  • 0

How can I increment a list in python.In the following case

So that means
I want to append several lists into a single list is is easy like list1+list2

But I need to return a final list where all the lists will be appended and every single list will be an result of iteration.What I was trying like below:

def result():  
    temps = [list of links]
    final_list = [] 
    for link in temps:
        final_list = final_list+get_list(link) # get list returning a list and temps is a list
    return final_list


 def get_list(link):
        #process the link and return a list
        return li

But as every time before the loop,final_list is being initialized,I am getting the []+get_list()
I need all the previous values in my final list.

Sample input: [a list of links] Sample out put:final_list #contains
all the data as a single list returned from get_list()

  • 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-30T16:33:14+00:00Added an answer on May 30, 2026 at 4:33 pm

    So you want to turn a list of something into a list of lists and flatten it?

    >>> strings = ["one two", "three four", "five six"]
    >>> [value for s in strings for value in s.split()]
    ['one', 'two', 'three', 'four', 'five', 'six']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to ask a question that how can i increment a model field
All, How Can we increment a value like the following in django templates, {{
Can I create a javascript variable and increment that variable when I press a
So far I can list all the students essays but I want to be
I have a List containing a bunch of strings that can occur more than
I have a script that compiles a list of items that can be very
I want to make the following using list in HTML The following are the
I have a list of links that users can click. When a click is
I have the following Python code, that cycles thru the string and capitalizes each
How can I increment an integer value outside the scope of a parallel.foreach loop?

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.