Although helloTemplate.html isn’t supposed to have been viewed through the
user (as being a template), you need to open it up inside a web editor (like
Kompozer) to check out it. It’s legal to produce a web site inside a web
page editor with expressions in braces baked into it! Should you look
within the source view in Kompozer you will notice something such as
the literal string in helloWeb2.py, except the line is damaged up
differently. (This does not matter within the formatted result,
since in html, all white-colored space is the same.)
During the Normal mode, then add formatting like italics, as well as an
extra type of text, and save the file again (underneath the same
name). Run this program helloWeb3.py again, and find out that you simply
have had the ability to change the look of the output without
altering the Python program itself. That’s the purpose of while using
template html page, allowing the net output formatting to become
managed mostly individually in the Python program.
A far more complicated but a lot more common scenario is in which the
input information is processed and changed into results in some way, and
these results, frequently with some from the original input, are
baked into the site that’s created.
additionWeb.py, which utilizes web site file
additionTemplate.html.
The goal within the finish of the chapter would be to have user input originate from
an application on the internet as opposed to the keyboard on the local machine, but
either in situation the input continues to be changed into results and all sorts of
baked into an internet page. To create parts easily multiple-use, I obtain
the input inside a distinct place where the input is
processed. Consistent with the later situation with web forms,
all input is of string type ( using keyboard input for the time being).
Consider the program. You will notice merely a couple of new lines! Due to
the modular design, the majority of the program consists of recent
standard functions reused.
The only real new code is at the start and it is proven here:
Resourse: http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/