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

kaens apatheticagnostic at gmail.com
Tue May 22 23:10:21 EDT 2007


I think that's there because you just wanted to check if it was
available for import, implying that you didn't actually want to import
it right then.

On 22 May 2007 09:09:02 -0700, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list