[Tutor] Why not to use include?
jikanter at gmail.com
Mon Jun 9 16:57:51 CEST 2008
Another thing you can do is use django templates. they "work" to be
similarly to php in the browser, and have something called an
"extends" clause (see
http://www.djangoproject.com/documentation/templates/) but in the
background it is completely python (i.e. the template compiler), so it
is not as straight forward as
"preprocessing" html, but it amounts to the same.
Let me know if that helps,
On Mon, Jun 9, 2008 at 7:21 AM, W W <srilyk at gmail.com> wrote:
> Python can *too* import from a txt file (even if it contains HTML):
> f = open("myfile.html", "r")
> x = f.read()
> print x
> It even retains formatting (as far as I can tell)...
> On Sun, Jun 8, 2008 at 4:25 PM, Dotan Cohen <dotancohen at gmail.com> wrote:
>> 2008/6/8 Kent Johnson <kent37 at tds.net>:
>>> On Sun, Jun 8, 2008 at 3:14 PM, Dotan Cohen <dotancohen at gmail.com> wrote:
>>>> If this is not the case, then why are there so many "PHP vs. Python"
>>>> flame wars? PHP is designed for _only_ programming web pages, so far
>>>> as I understand, so if Python cannot do that why are the two languages
>>>> compared so often?
>>> Python is a general purpose language that can, among other things, be
>>> used to generate web pages in many different ways. Possibly none of
>>> these ways match your pre-conceptions. Please do some reading.
>>> Probably the simplest way to generate a web page from Python is with a
>>> cgi module. Here is a simple example:
>> I see, it is not exactly what I was expecting. Thanks.
>> Dotan Cohen
>> A: Because it messes up the order in which people normally read text.
>> Q: Why is top-posting such a bad thing?
>> Tutor maillist - Tutor at python.org
> To be considered stupid and to be told so is more painful than being
> called gluttonous, mendacious, violent, lascivious, lazy, cowardly:
> every weakness, every vice, has found its defenders, its rhetoric, its
> ennoblement and exaltation, but stupidity hasn't. - Primo Levi
> Tutor maillist - Tutor at python.org
email: jikanter |at| gmail |dot| com
More information about the Tutor