November 21st, 2002, 12:59 AM
Python: The 'Include' feature
I just want to know whether or not Python can 'include' HTML or scripts like PHP.
I know the PHP script to include is:
<?php include(" SOMETHING HERE "); ?>
but I don't know what is the include script for Python. Does anyone know anything about it? Does Python even have this feature? If not, does Zope have it?
Any help would be very nice.
November 21st, 2002, 08:24 PM
you can check out Spyce at http://spyce.sourceforge.net/
Spyce let's you insert python in your Python documents to generate dynamic content just like PHP does. It has an include module which should do what you want.
November 22nd, 2002, 01:04 AM
But Spyce requires installation. I want the Python 'include' feature. Do you have any other suggestions?
November 24th, 2002, 01:14 PM
Why not just use the 'import' statement?
December 4th, 2002, 12:03 PM
I'm pretty sure the import statement isn't quite the same as a preprocessor style inclusion.
Zope does have support for this sort of thing, but unfortunately, I don't remember the syntax for it. But setting up zope is even harder than setting up Spyce. Spyce is one answer, as is Webware for Python. One of those two seems to be the easiest route to get where you are going.
December 4th, 2002, 05:57 PM
But he wants to know if Python can include files like PHP does... Which is exactly what import is. You can include other Python files you create with the import statement. I don't think he needs anything preprocessed.
December 5th, 2002, 08:00 AM
No, that seems to be the problem - he doesn't want to include other Python files. He wants to include HTML. Which would end up trying to be parsed by the interpreter when the script is called. Which would, of course, be bad.
December 5th, 2002, 11:00 AM
Oh, I see.... Kind of misinterpreted the post. Sorry 'bout that.
What part of Houston you from? I am originally from Sugar Land.