Jesse Noller wrote:
> A question in a similiar vein:
>
> I have appended 2 different directories to my path (via
> sys.path.append) now - without knowing the names of the files in those
> directories, I want to force an import of the libraries ala:
>
> for f in os.listdir(os.path.abspath(libdir)):
> module_name = f.strip('.py')
This doesn't do what you think it does:
>>> 'pyoopsyp.py'.strip('.py')
'oops'
Read the docs on strip(), and then the docs on os.path.splitext() and
friends, and/or download and use Jasen Orendorrf's "path" module which
will make all your path-related code half the size and twice as easy to
read and write.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list