multiline snippets with triple quotes

John Lenton john at grulic.org.ar
Sat Aug 14 12:29:21 CEST 2004


On Fri, Aug 13, 2004 at 09:22:38AM -0400, Christopher T King wrote:
> 
> AFAIK, triple quotes do everything heredocs do (but with a cleaner 
> syntax!); the following produce identical output:
> 
> bash heredocs:
> 
> echo -n <<EOF
> Some text.
>   Woo!
> The end.
> EOF
> 
> Python triple quotes:
> 
> print '''\
> Some text.
>   Woo!
> The end.'''

what about
cat <<-EOF
>	1
>	2
>	3
>	EOF
1
2
3



-- 
John Lenton (john at grulic.org.ar) -- Random fortune:
<JHM> Somehow I have more respect for 14 year old Debian developers than
     14 year old Certified Microsoft Serfs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20040814/5afb71cd/attachment.pgp>


More information about the Python-list mailing list