Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > doing non-prespecified imports

Reply
Thread Tools

doing non-prespecified imports

 
 
Jon Perez
Guest
Posts: n/a
 
      07-31-2004
Is it possible to do:

import xxxx

within code where xxxx is specified by
a string or user input?


I need this in order to be able to load different,
arbitrary modules under application-user control.

If not using the 'import xxxx' syntax, is there
a roundabout way to do such?
 
Reply With Quote
 
 
 
 
Egbert Bouwman
Guest
Posts: n/a
 
      07-31-2004
On Sat, Jul 31, 2004 at 08:32:14AM +0800, Jon Perez wrote:
> Is it possible to do:
>
> import xxxx
>
> within code where xxxx is specified by
> a string or user input?
>
>
> I need this in order to be able to load different,
> arbitrary modules under application-user control.
>

See the built-in function __import__()
egbert
--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
================================================== ======================
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic imports + relative imports in Python 3 zildjohn01 Python 0 02-22-2011 05:24 PM
Imports System.Data or Imports System.Data.SqlClient? Albert ASP .Net 4 07-10-2008 09:00 AM
Re: Imports Jim Heavey ASP .Net 1 10-17-2003 06:00 PM
REFERENCE VS IMPORTS Bite My Bubbles ASP .Net 0 08-25-2003 09:00 PM
Imports 'System.DirectoryServices' cannot be found. Edward ASP .Net 1 07-08-2003 12:45 AM



Advertisments