Import without a .py file

Roger Upole rupole at compaq.net
Thu May 11 23:01:17 EDT 2000


The eff-bot posted an incredibly compact and clever way to do exactly
this just a couple of days ago.  The subject was
"How to execute lists of code?".
               Roger Upole

"Michael Ross" <mross at rochester.rr.com> wrote in message
news:391B58DF.4605438B at rochester.rr.com...
>
> I would like to accomplish the equivalent of an import, but store module
> code in a database (rather than in .py files).
>
> Is there any way to create a module using code that did not originate in
> a file?  For example, I can get the text for the code into a string
> object, and then I'd like to say
>
> s = ...string containing code with classes and functions...
> import module using s
>
> obviously I can't do that, but something equivalent would be nice.
>
>
> Thanks!
> Mike Ross
>
>
>
>





More information about the Python-list mailing list