Python for a PHP user, how do i...?

rw2 richw at objenv.com
Wed May 16 11:38:29 EDT 2001


In article <vRiM6.83384$2U.38290537 at news2.rdc2.tx.home.com>, "Rainer
Deyke" <root at rainerdeyke.com> wrote:

> "rw2" <richw at objenv.com> wrote in message
> news:20010515.162432.2118421993.2310 at mayne.dhcp.fnal.gov...
> Except that 'exec' isn't a function.  You can't do this:
> 
> eval('exec "print \'spam\'"')
> 
> or this:
> 
> f = exec

But you can do:

>>> bob="""for i in ('jim','bob'):
...   print i
... """
>>> exec(bob)
jim
bob

Which was how *I* read the original question.

rw2

--
I'm currently looking for a U.S. consulting contract in C++, Java or
Python



More information about the Python-list mailing list