954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

python cgi question.

I was wondering if anyone could tell me how to save a html page to a website's filemanager
labeled as .html so that it would be searchable.
Like a wiki.

for example:


print ""
print "python"
print ""
print """ I would Like to save this page as http://www.mysite.com/python.html"""
print "

Sinnocence
Newbie Poster
10 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

I was wondering if anyone could tell me how to save a html page to a website's filemanager labeled as .html so that it would be searchable. Like a wiki.

for example:

print "" print "python" print "" print """

I would Like to save this page as http://www.mysite.com/python.html

""" print "
Sinnocence
Newbie Poster
10 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

so this shouldn't be so hard.

os.mkdir("/home/weburl/public_html/mydirectory")
the above works fine

how would I place a blank html file in the same directory as above.
(blank.html for this example)

Sinnocence
Newbie Poster
10 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

Sorry for asking for code...I understand this is a very ilogical way of saving pages, I also left out far to much information.

+generic webhosting provider using apache:+ In this case justhost.com

fo = open("/homedirectory/etc/etc/%s.html" then obviously you would specify the 'r' or 'w+' options if you need to create the file or append, followed by the standard .close()

In the above '%s', simply refers to the desired documents/file's title you wish to create.

Just like you would do with a simple .txt file :)

Benfits if a user now types http://www.yousite.com/%s.html the page will be created and saved.

I hope this helps some one who is interested in learning more about the python language.

Sinnocence
Newbie Poster
10 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You