including files

Rainer Deyke root at rainerdeyke.com
Mon Jul 10 15:25:14 EDT 2000


"Fernando Rodríguez" <frr at mindless.com> wrote in message
news:9yna5.229$iT2.4602 at m2newsread.uni2.es...
> Hi!
>
>     What's teh Python's equivalent for C's #include "myfile.h"? O:-)

The standard substitute is:

import myfile

However, this is not quite equivalent to #include.  If you really need
behavior identical to #include, you could try the following:

exec open("myfile.h").read()


--
Rainer Deyke (root at rainerdeyke.com)
Shareware action/role-playing games      -      http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list