[Tutor] import by filename

Chad Crabtree flaxeater at yahoo.com
Wed Aug 25 23:02:47 CEST 2004

I would like to import files by their name.  I will search a
looking for a specific extension then import it as a python module I 
think this might be it.  However I am not finding this particularly 
transparent.  What I'm worried about is whether or not it needs to
a python extension.

*load_source*( 	name, pathname, file)

Load and initialize a module implemented as a Python source file and 
return its module object. If the module was already initialized, it
be initialized /again/. The name argument is used to create or access
module object. The pathname argument points to the source file. The
argument is the source file, open for reading as text, from the 
beginning. It must currently be a real file object, not a
class emulating a file. Note that if a properly matching
file (with suffix .pyc or .pyo) exists, it will be used instead of 
parsing the given source file.

Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!

More information about the Tutor mailing list