[Tutor] Why not to use include?

Jordan Kanter 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,

Jordan

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
> f.close()
>
> It even retains formatting (as far as I can tell)...
>
> HTH,
> Wayne
>
> 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:
>>> http://wiki.python.org/moin/CgiScripts
>>>
>>
>> I see, it is not exactly what I was expecting. Thanks.
>>
>> Dotan Cohen
>>
>> http://what-is-what.com
>> http://gibberish.co.il
>> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
>>
>> 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
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
>
>
> --
> 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
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Jordan Kanter
email: jikanter |at| gmail |dot| com
mobile: (847)436-6388
IRC(Freenode): jikanter


More information about the Tutor mailing list