[Tutor] Why not to use include?

W W srilyk at gmail.com
Mon Jun 9 14:21:41 CEST 2008


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


More information about the Tutor mailing list