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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:24:54+00:00 2026-05-30T09:24:54+00:00

I’m trying to write a response from a Solr server to a CSV file.

  • 0

I’m trying to write a response from a Solr server to a CSV file. I’m pretty new to python and have been given code to modify. Originally the code looked like this …

for doc in response.results:
    status = json.loads(doc['status'])

The script runs and prints the correct information. But it only every prints one result (last one). I think this is because the loop constantly writes over the varible ‘status’ until its worked through the response.

After some reading I decided to store the information in a list. That way i could print the information to seprate lines in a list. I created an empty list and changed the code below –

for doc in response.results:
    list.append = json.loads(doc['status'])

I got this response back after trying to run the code –

`AttributeError: 'list' object attribute 'append' is read-only`.

Where am I going wrong? Is a list not the best approach?

  • 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-30T09:24:55+00:00Added an answer on May 30, 2026 at 9:24 am
    >>> list.append
    <method 'append' of 'list' objects>
    

    You’re trying to modify the append method of the built-in list class!

    Just do

    docstats = []
    for doc in response.results:
        docstats.append(json.loads(doc['status']))
    

    or equivalently:

    docstats = [json.loads(doc['status']) for doc in response.results]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read in a string from a C# Response.Write(string example) into
I am trying to read a response from a server and transform it from
I'm getting a 503 response from a server that I'm trying to communicate with.
I have been tasked with obtaining a response from a SOAP request, using classic
I'm trying write a query to find records which don't have a matching record
Trying to write a couple of functions that will encrypt or decrypt a file
Im trying to write a single byte at a certain location in a file.
Im trying to write something to get my images to show correctly. I have
im trying to write an app that will display a list off lines from
I'm trying to write a blog post which includes a code segment inside a

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.