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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:17:20+00:00 2026-05-29T18:17:20+00:00

I made a script for python that suggested music to someone, and was wondering

  • 0

I made a script for python that suggested music to someone, and was wondering if there was a way to put that inside a webpage. Is there a way to embed python in HTML somehow, or another way to put Python scripts in a webpage, or am I better off doing the script in Javascript?
It’s pretty basic, just an input/response thing with a couple of functions, like

input("Blah blah")
if input == 'yes':
print("example")

but obviously a bit more complicated.

  • 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-29T18:17:22+00:00Added an answer on May 29, 2026 at 6:17 pm

    The problem with a javascript only solution is that your data must be hard-coded.
    With a server-script you can do so much more.

    The difficult bit is setting up a proper server. I will evade this step by using python’s default CGISERVER.

    Here is probably the easiest way to achieve what you want (very minimal server setup):

    create a directory called cgi-bin/
    in that directory create your python script (make sure it has executable rights)

    #!/usr/bin/python
    
    print 'Content-Type: text/html'
    print
    print '<html>'
    print '<head><title>Hello from Python</title></head>'
    print '<body>'
    print '<h2>Hello from Python</h2>'
    print '</body></html>'
    

    run the command python -m CGIHTTPServer in the same directory. Access your server on localhost:8000/cgi-bin/yourscript.py

    Note that handling HTTP requests and responses by hand like this can get very tiresome and error prone, and you would be best off using one of the many Python web frameworks (like web.py or Django etc).

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

Sidebar

Related Questions

I've made a quick python script that converts to Unicode from ASCII and back.
I made a .pyw python script that I want to have running in the
I made a c extension out of a python script that was fairly labour
My hosting provider says my python script must be made to be executable(chmod755). What
I made a script that spawns a remote shell or runs a local shell
What happes when the script that made @mysql_connect($server, $user, $password) dies? How long does
While importing a python script from another script I want the script code that
I have a python script that will take each file in a directory, iterate
So I wrote a little script in python that brings up a gui with
I have dates in a Python script that I need to work with that

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.