including files
Matthew Schinckel
matt at null.net
Mon Jul 10 23:47:59 EDT 2000
On Jul 10, I overheard Fernando Rodríguez mutter:
> Hi!
>
> What's teh Python's equivalent for C's #include "myfile.h"? O:-)
>
Depends. Usually
>>> import myfile
or
>>> from myfile import *
But, if you have a file with commands that you need executed in the
current namespace (say, like some generated code do build a GUI menu :-)
then you might want to look at:
>>> execfile('myfile')
--
Matthew Schinckel <matt at null.net>
What I tell you three times is true.
More information about the Python-list
mailing list