Moving from PHP to Python. Is it Possible

imageguy imageguy1206 at gmail.com
Fri Dec 11 13:36:39 EST 2009


> So My question is.
> For example I had this kind of python file and we want to use this as plugin
> template
>
>   <div class='foo'>
>   <%
>   for n in range(3):
>       # This indent will persist
>   %>
>   <p>This paragraph will be
>   repeated 3 times.</p>
>   <%
>   # This line will cause the block to end
>   %>
>   This line will only be shown once.<br>
>   </div>
>
> on execution time, I want to import this template file, execute as python
> script and store output in a GLOBAL dictionary for later usage.
>
> Is it possible ?
>

Have you checked out one of the templating systems modules ?
I have used Cheetah quite successfully, but there a numerous other
options.
http://www.cheetahtemplate.org/
I think you will find that a template system (like Cheetah) will give
you the best results with the most maintainable structure.

g.



More information about the Python-list mailing list