Easy "here documents" ??

Jim Hill jimhill at swcp.com
Mon Dec 20 06:50:30 CET 2004


Nick Craig-Wood  wrote:

>Jim Hill <jimhill at swcp.com> wrote:
>>  Is there a way to produce a very long multiline string of output with
>>  variables' values inserted without having to resort to this wacky
>>  """v = %s"""%(variable)

>I prefer this
>
>   ... I'll have %(amount)s %(what)s
>   ... for $%(cost)s please""" % locals()

Looks pretty slick.  This might just be what I need.

>Its almost as neat as perl / shell here documents and emacs parses """
>strings properly too ;-)

Mmm...emacs...

Thanks for the tip.


Jim
-- 
"I regard NASCAR the same way I regard gay porn: I know it exists and I
know some guys like it; I just don't want to see it."  --  Z. B. Goode



More information about the Python-list mailing list