embedding python in python

Steve Holden steve at holdenweb.com
Thu Sep 30 08:19:38 EDT 2004


Maurice LING wrote:

> Lonnie Princehouse wrote:
> 
>> Maurice LING <mauriceling at acm.org> wrote in message 
>> news:<415a7f0b$1 at news.unimelb.edu.au>...
>>
>>> Hi,
>>>
>>> anyone had any experiences in embedding python in python?
>>>
>>> I've tried to do this but it doesn't work.
>>>
>>> eval("from Tkinter import *")
>>>
>>> Thanks
>>> maurice
>>
>>
>>
>> You need exec for statements:
>>
>>     exec("from Tkinter import *")
> 
> 
> Thank you.
... and note that exec is a statement introduced by a keyword, not a 
function call, so

exec "from Tkinter import *"

is a less misleading way to write it.

regards
  Steve



More information about the Python-list mailing list