Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2002, 11:59 PM
doreg28 doreg28 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 2 doreg28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Python: The 'Include' feature

Hello,

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.
Thanks!

Ye Tan

Reply With Quote
  #2  
Old November 21st, 2002, 07:24 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 12
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.

Reply With Quote
  #3  
Old November 22nd, 2002, 12:04 AM
doreg28 doreg28 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 2 doreg28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks jimmy2k1,

But Spyce requires installation. I want the Python 'include' feature. Do you have any other suggestions?

Reply With Quote
  #4  
Old November 24th, 2002, 12:14 PM
Hartmann's Avatar
Hartmann Hartmann is offline
chown python:users\ /world
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Texas Tech
Posts: 95 Hartmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Why not just use the 'import' statement?
__________________
Hartmann
badice.com

Reply With Quote
  #5  
Old December 4th, 2002, 11:03 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Quote:
Originally posted by Hartmann
Why not just use the 'import' statement?

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.
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #6  
Old December 4th, 2002, 04:57 PM
Hartmann's Avatar
Hartmann Hartmann is offline
chown python:users\ /world
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Texas Tech
Posts: 95 Hartmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
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.

Reply With Quote
  #7  
Old December 5th, 2002, 07:00 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Quote:
Originally posted by Hartmann
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.

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.

Reply With Quote
  #8  
Old December 5th, 2002, 10:00 AM
Hartmann's Avatar
Hartmann Hartmann is offline
chown python:users\ /world
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Texas Tech
Posts: 95 Hartmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Oh, I see.... Kind of misinterpreted the post. Sorry 'bout that.

What part of Houston you from? I am originally from Sugar Land.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python: The 'Include' feature

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap