On Jan 10, 2:10 pm, Thomas Troeger <[EMAIL PROTECTED]> wrote: > Dear all, > > I've written a program that parses a string or file for embedded python > commands, executes them and fills in the returned value. The input might > look like this: > > process id: $$return os.getpid()$$ > current date: $$return time.ctime()$$ > superuser: $$ > if os.geteuid(): > return "Yes" > else: > return "No"$$ > > I've tried several solutions using eval, execfile or compile, but none > of those would solve my problem. Does anyone have a solution that works? > Any suggestions? Any help will be appreciated :) >
AST visitor approach: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440629 -- http://mail.python.org/mailman/listinfo/python-list