Include File?

Harry George harry.g.george at boeing.com
Mon Oct 6 02:52:12 EDT 2003


Cam <no-spam_please__cpbarton at pacific.net.au> writes:

> I am not so new and I still dont know if its possible.
> I 2nd that question.
> 
> Whofer wrote:
> > Hi
> > i am a totally python newcomer. Can i use
> > include files within python?
> > (like for example:  include <xxx.py>)
> > Thanks for help in advance
> > Werner Hofer
> >
> 

There is no raw-file include (as in C's cpp) in the Python language.
(Of course, you could use #include and run cpp on the file
before passing it to Python.)

The Pythonic way to do this is "import".  Unlike cpp, the imported
file must be a valid python module in its own right, though it can be
pretty simplistic.  E.g., you could just define a list.

-- 
harry.g.george at boeing.com
6-6M31 Knowledge Management
Phone: (425) 342-5601




More information about the Python-list mailing list