howto check does module 'asdf' exist? (is available for import)

Asun Friere afriere at yahoo.co.uk
Tue May 22 02:42:06 EDT 2007


On May 21, 11:17 pm, dmitrey <open... at ukr.net> wrote:
> howto check does module 'asdf' exist (is available for import) or no?

try :
  import asdf
  del asdf
except ImportError :
  #do stuff ...

> (without try/cache of course)

Oops sorry, you didn't want it the obvious way ... but why ever not?






More information about the Python-list mailing list