Gabriel Genellina wrote:
En Wed, 04 Nov 2009 02:45:23 -0300, iu2 escribió:
On Nov 4, 3:10 am, "Gabriel Genellina" wrote:
txt = """
def foo(x):
print 'x=', x
def bar(x):
return x + x
"""
py> namespace = {}
py> exec txt in namespace
py> namespace.keys()
['__builtins__', 'foo', 'bar']
En Wed, 04 Nov 2009 02:45:23 -0300, iu2 escribió:
On Nov 4, 3:10 am, "Gabriel Genellina" wrote:
txt = """
def foo(x):
print 'x=', x
def bar(x):
return x + x
"""
py> namespace = {}
py> exec txt in namespace
py> namespace.keys()
['__builtins__', 'foo', 'bar']
py> namespace['foo']('hell
On Nov 4, 3:10 am, "Gabriel Genellina" wrote:
> En Tue, 03 Nov 2009 17:36:08 -0300, iu2 escribió:
>
>
>
>
>
> > On Nov 3, 7:49 pm, Matt McCredie wrote:
> >> iu2 elbit.co.il> writes:
>
> >> > Having a file called funcs.py, I would like to read it into a string,
> >> > and then import from that s
On Nov 3, 7:49 pm, Matt McCredie wrote:
> iu2 elbit.co.il> writes:
>
>
>
> > Hi,
>
> > Having a file called funcs.py, I would like to read it into a string,
> > and then import from that string.
> > That is instead of importing from the fie system, I wonder if it's
> > possible to eval the text i
En Tue, 03 Nov 2009 17:36:08 -0300, iu2 escribió:
On Nov 3, 7:49 pm, Matt McCredie wrote:
iu2 elbit.co.il> writes:
> Having a file called funcs.py, I would like to read it into a string,
> and then import from that string.
> That is instead of importing from the fie system, I wonder if it's
iu2 elbit.co.il> writes:
>
> Hi,
>
> Having a file called funcs.py, I would like to read it into a string,
> and then import from that string.
> That is instead of importing from the fie system, I wonder if it's
> possible to eval the text in the string and treat it as a module.
>
> For exampl