Coming from Perl

Amer Neely perl4hire at softouch.on.ca
Wed Sep 12 20:54:05 EDT 2007


Ben Finney wrote:
> Amer Neely <perl4hire at softouch.on.ca> writes:
> 
>> A question I have, if someone here is familiar with Perl, does Python
>> have something like Perl's 'here document'?
> 
> I'm not sure exactly what behaviour you want, but Python accepts
> literal strings to be triple-quoted (i.e. delimited by """ pairs or
> ''' pairs), which allows you to freely use literal line feed and quote
> characters inside that string.
> 
>     <URL:http://docs.python.org/ref/strings.html>
> 

I saw that and I guess that is the closest thing. In Perl I can do ..

print <<EndHTML;
<html>
<body>
Hello
</body>
</html>
EndHTML

In this case 'EndHTML' is a label, and I'm telling perl to print 
everything as is up to that label.

-- 
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"



More information about the Python-list mailing list