can regular ol' python do a php include?
fredrik at pythonware.com
Tue Oct 10 16:26:57 CEST 2006
John Salerno wrote:
> Whenever I turn an eye back toward website design, I find myself making
> frequent use of PHP's include function (or SSI's include directive). So
> I'm curious, is there a way to do this with Python using just the
> standard library?
you don't even need anything from the standard library to inserting output
from one function into given text...
text = "... my page with %(foo)s markers ..."
print text % dict(foo=function())
(doing this with output from another Python script is of course also easy;
just use execfile, and collect the output, but that's pretty silly when you can
import the darn thing, and call it instead).
More information about the Python-list