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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:21:10+00:00 2026-06-09T21:21:10+00:00

I got a Python function that outputs a list like this, def get_items(argument): for

  • 0

I got a Python function that outputs a list like this,

def get_items(argument):    
    for item in items:
        print item

On the terminal, when I pass an argument to my function and print, like, “get_items(test)” I get:

item1
item2
item3

Now, I need to get this on post through storage field (I already got this part working, but I can only print variables with static content, while the content of a list inside a function will return “None”). What I need looks like this,

item1
item2
item3

In view source, it will look like this,

<p>
item1<br/>
item2<br/>
item3<br/>
</p>

I’m stomped on how to print this, which in php would be such a simple approach as embedding php within the html content. However, Python throws a 500 error anytime I try anything….
Please, help!

  • 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-09T21:21:11+00:00Added an answer on June 9, 2026 at 9:21 pm

    If you are executing your script as a CGI- your script MUST echo out a Content-type followed by 2 returns before anything else:

    print "Content-Type: text/html\n"
    
    def get_items(item):    
        for item in items:
            print item+'<br />'
    
    print "<p>"
    get_items(foo)
    print "</p>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a little Python extension in C/C++, and I've got a function like
I've got a python function that should loop through a tuple of coordinates and
I've got a website that I wrote in python using the CGI. This was
I've got some Python code that will automatically print a set of data in
I've got a python script that calls a bunch of functions, each of which
I've got a Python 2.7 program that imports win32clipboard . I tried to freeze
I've got a python package which outputs considerable help text from: help(package) I would
I've got a python list of dictionaries: mylist = [ {'id':0, 'weight':10, 'factor':1, 'meta':'ABC'},
i've got this snazzy python code: import subprocess value = subprocess.Popen([php,./php/php_runner.php],stdout=subprocess.PIPE); the problem is,
I'm getting on quite well with Django & Python, just got a search function

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.