HTML FORM AND PYTHON

S

subhabrata.iisc

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.
 
D

Diez B. Roggisch

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
 
S

subhabrata.iisc

Hi Diez,
Thanx for the suggestion. I am checking if anything helpful I can find
there.
Regards,
Subhabrata.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top