473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HTML FORM AND PYTHON

Dear Members of the group,
I have a small question, if you can help me to find the answer.
I have one function:
def add_string(n):
print “Print Two strings”
print “Print the First String”
a1=raw_input(“PRINT THE FIRST STRING”)
a2=raw_input(“PRINT THE SECOND STRING”)
print “CONCATENATING THE TWO GIVEN STRINGS”
a3=a1+a2
print “THE RESULT IS”
print a3

Now, I have designed one HTML form which has two input fields for text
and an output field for the result.

I like to bind the python program into HTML form.
i) Is there any way I can keep both my existing python code and HTML
code and bind them? If any one can suggest with example.
ii) Do I have to write the whole code in a way in python so that it
would work the function as well as generate HTML form I am looking
for? If any one can suggest with example.
iii) Is there any other way?
Best Regards,
Subhabrata.
Jun 27 '08 #1
2 1340
su*************@hotmail.com schrieb:
Dear Members of the group,
I have a small question, if you can help me to find the answer.
I have one function:
def add_string(n):
print “Print Two strings”
print “Print the First String”
a1=raw_input(“PRINT THE FIRST STRING”)
a2=raw_input(“PRINT THE SECOND STRING”)
print “CONCATENATING THE TWO GIVEN STRINGS”
a3=a1+a2
print “THE RESULT IS”
print a3

Now, I have designed one HTML form which has two input fields for text
and an output field for the result.

I like to bind the python program into HTML form.
i) Is there any way I can keep both my existing python code and HTML
code and bind them? If any one can suggest with example.
No. The above code works with user-interation at certain points of the
program. That can't be (easily, and especially not with the above
functionality) translated into the http-paradigm where each operation is
embedded into a request/resonse-cycle, with the need for explicit or
implicit state-keeping over these cycles.
ii) Do I have to write the whole code in a way in python so that it
would work the function as well as generate HTML form I am looking
for? If any one can suggest with example.
For this *trivial* example, I can only say: there isn't enough to be
worth abstracting.
iii) Is there any other way?
Google python + webframeworks to find a bazillion discussions, opinions,
examples.

Diez
Jun 27 '08 #2
Hi Diez,
Thanx for the suggestion. I am checking if anything helpful I can find
there.
Regards,
Subhabrata.

Diez B. Roggisch wrote:
su*************@hotmail.com schrieb:
Dear Members of the group,
I have a small question, if you can help me to find the answer.
I have one function:
def add_string(n):
print �Print Two strings�
print �Print the First String�
a1=raw_input(�PRINT THE FIRST STRING�)
a2=raw_input(�PRINT THE SECOND STRING�)
print �CONCATENATING THE TWO GIVEN STRINGS�
a3=a1+a2
print �THE RESULT IS�
print a3

Now, I have designed one HTML form which has two input fields for text
and an output field for the result.

I like to bind the python program into HTML form.
i) Is there any way I can keep both my existing python code and HTML
code and bind them? If any one can suggest with example.

No. The above code works with user-interation at certain points of the
program. That can't be (easily, and especially not with the above
functionality) translated into the http-paradigm where each operation is
embedded into a request/resonse-cycle, with the need for explicit or
implicit state-keeping over these cycles.
ii) Do I have to write the whole code in a way in python so that it
would work the function as well as generate HTML form I am looking
for? If any one can suggest with example.

For this *trivial* example, I can only say: there isn't enough to be
worth abstracting.
iii) Is there any other way?

Google python + webframeworks to find a bazillion discussions, opinions,
examples.

Diez
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Luiz Siqueira Neto | last post by:
Somebody know how make html forms or python forms inside html to use as gui application? The idea is make a client application like a web site of my interprise for customers who don't have good...
3
by: Nancy | last post by:
Hi, Guys, I am new to Python. I am trying to following the example on http://www.modpython.org/live/current/doc-html/tut-pub.html In this example, it gives the following html code, <form...
7
by: Hansan | last post by:
Hi all, I hope you have time to help me out a little. My problem is that I want to combine some python code I have made with some html templates, I found a tutorial at dev shed:...
14
by: Philippe C. Martin | last post by:
Hi, I wish to use an easy way to generate reports from wxPython and feel wxHtmlEasyPrinting could be a good solution. I now need to generate the HTML wxHtmlEasyPrinting can print: I need to...
2
by: Thomas SMETS | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear, I need to parse XHTML/HTML files in all ways : ~ _ Removing comments and javascripts is a first issue ~ _ Retrieving the list of fields...
16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
2
by: wipit | last post by:
I need to process a HTML form in python. I'm using urllib2 and HTMLParser to handle the html. There are several steps I need to take to get to the specific page on the relevant site the first of...
8
by: flit | last post by:
Hello All, I am trying to get information from a form and send it to a python script without success.. Here is my objective: User enters data in form --form send variables to python script...
9
by: mosscliffe | last post by:
I am struggling to find a python example of the scenario - I have. I have a python script, which generates a page with a search button (actually an input field). The data from the above...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.