Includeing Python in text files

Laurent Pointal laurent.pointal at limsi.fr
Mon May 22 07:07:38 EDT 2006


Paolo Pantaleo a écrit :
> I am working on this:
> 
> I have  a text file, containig certain section in the form
> <?py
>  python code here
> py?>
> 
> I parse the text file and substitute the python code with its result
> [redirecting sys.stdin to a StringIO]. It something like php or
> embedded perl.
> 
> So my little toy works not bad, but I was wondering if such a feature
> already existed, if yes, can you point me out some links?

Yes Python Inside HTML, like this example from Karrigell docs
( http://karrigell.sourceforge.net/en/pythoninsidehtml.htm ):

The current date is
<% import time
print time.strftime("%d:%m:%y",time.localtime(time.time()))
%>


See http://karrigell.sourceforge.net/

A+

Laurent.



More information about the Python-list mailing list