HTML FORM AND PYTHON

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • subhabrata.iisc@hotmail.com

    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(“P RINT THE FIRST STRING”)
    a2=raw_input(“P RINT 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.
  • Diez B. Roggisch

    #2
    Re: HTML FORM AND PYTHON

    subhabrata.iisc @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(“P RINT THE FIRST STRING”)
    a2=raw_input(“P RINT 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

    Comment

    • subhabrata.iisc@hotmail.com

      #3
      Re: HTML FORM AND PYTHON

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

      Diez B. Roggisch wrote:
      subhabrata.iisc @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 �CONCATENATIN G 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

      Comment

      Working...