include files?
John J. Lee
jjl at pobox.com
Fri Jun 20 08:11:57 EDT 2003
"rgndrp" <erased*remove_this*@xs4all.nl> writes:
> Thomas Güttler wrote:
[...]
> > Does this help you?
> >
> > main.py:
> > include variables
> > if variables.myvar==5:
> > print "OK"
> >
> > variables.py:
> > myvar=5
[...]
> it would if i'd get it to work :)
> now it returns this cgi error:
[...]
> include applic.py
[...]
1. Thomas meant to say 'import', not include.
2. You don't want the '.py' in the import statement.
Two files, main.py and variables.py:
# -------------START main.py:----------------
import variables
if variables.myvar==5:
print "OK"
# -------------END main.py:----------------
# -------------START variables.py:----------------
myvar=5
# -------------END variables.py----------------
No, you don't need the comments, they're just there to show you where
the files begin and end. :-)
John
More information about the Python-list
mailing list