looking for template package
Philip Semanchuk
philip at semanchuk.com
Tue Mar 3 21:29:10 EST 2009
On Mar 3, 2009, at 9:06 PM, Neal Becker wrote:
> I'm looking for something to do template processing. That is,
> transform
> text making various substitutions. I'd like to be able to do
> substitutions
> that include python expressions, to do arithmetic computations within
> substitutions.
>
> I know there are lots of template packages, but most seem aimed at
> web use.
> This is just text processing, not part of any web stuff.
>
> Any suggestions?
Hi Neal,
There are lots of template packages out there that will do the job. I
think you'll have a hard time finding one that's not aimed primarily
at Web use.
I like Mako. The templating language has a pretty shallow learning
curve and it's not too hard to run Mako from the command line
independently of any Web framework. FWIW I've used Mako to generate
Apache config files and it worked fine for that.
As I said, there are lots of choices and the template syntax varies
widely. Some use XML-based templates which I find painful. But people
who use lots of XMLish tools probably appreciate the structure. You
know your preferences best, so pick a template package that has a
syntax you won't hate.
Good luck
Philip
More information about the Python-list
mailing list