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

Paul Rubin http
Tue May 22 12:09:02 EDT 2007


Asun Friere <afriere at yahoo.co.uk> writes:
> > howto check does module 'asdf' exist (is available for import) or no?
> try :
>   import asdf
>   del asdf
> except ImportError :
>   print "module asdf not available"
> else :
>   print "module asdf available for loading"

But this has a side effect: if asdf is already loaded, it deletes it.



More information about the Python-list mailing list