format strings or page tempaltes

Jeff Davis jdavis at empires.org
Tue Jul 23 07:49:04 EDT 2002


I am trying to make use of an organized templating system for web 
development. I really just need something simple, so I was considering 
using format strings (just doing "open('mytemplate').read() % mydict"). 
The only thing that seems to be lacking for me is the ability to call a 
function with arguments from the template file. For example, here's what 
I'd like to be able to do:

<html>
....
%(myfunction("foo"))s
.....
</html>

where the format would be replaced by the return value of myfunction.

Is this possible with the string format syntax? If not, could someone 
recommend a good template module or something similar?

Thanks,
        Jeff



More information about the Python-list mailing list