[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
directory
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
have
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
will
be initialized /again/. The name argument is used to create or access
a
module object. The pathname argument points to the source file. The
file
argument is the source file, open for reading as text, from the
beginning. It must currently be a real file object, not a
user-defined
class emulating a file. Note that if a properly matching
byte-compiled
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!
http://promotions.yahoo.com/new_mail
More information about the Tutor
mailing list