[Tutor] Interpret Statement

Sean 'Shaleh' Perry shaleh@valinux.com
Tue, 29 Aug 2000 11:12:22 -0700 (PDT)


On 29-Aug-2000 Perry, George W. wrote:
> Some interpreted languages have an Interpret statement that allows you to
> build a statement on the fly, and execute it. Does Python have something
> similar?
> 

geisha [~] $ python
Python 1.5.2 (#0, Apr  3 2000, 14:46:48)  [GCC 2.95.2 20000313 (Debian
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> code = 'print \'Hi Mom\''
>>> exec(code)
Hi Mom
>>>