Some Newbie Questions

Slawomir Nowaczyk slawek at cs.lth.se
Wed May 26 18:34:44 EDT 2004


On Wed, 26 May 2004 12:56:21 +0200
Leopold Schwinger <leoel at gmx.at> wrote:

#> (2) Is there any way to dynamically import modules, where the name
#> of the module is not known during implementation but can be defined
#> during scipt execution?

Sure:

Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exec("import socket")
>>> socket.socket()
<socket._socketobject object at 0x00952750>

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( Slawomir.Nowaczyk at cs.lth.se )

Write your questions down on the back of $20 dollar bill and send them to me.





More information about the Python-list mailing list