Easy "here documents" ??

Fredrik Lundh fredrik at pythonware.com
Mon Dec 20 08:28:37 CET 2004


Jim Hill wrote:

> I'm trying to write a script that writes a script for a rather specialized
> task.  I know that seems weird, but the original version was written in
> Korn shell and most of my team are familiar with the way it does things
> even though they don't read Korn.

so why didn't you tell us? ;-)

if you want $-style interpolation, you can use the new string.Template
class (mentioned in passing by Nick above); useful examples here:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/304004

if you don't have 2.4, you can use the RE machinery for the same purpose;
see e.g.

    http://effbot.org/zone/re-sub.htm#simple-templating

</F> 






More information about the Python-list mailing list