Skip to content

Instantly share code, notes, and snippets.

@davepape
Created April 2, 2014 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davepape/9936615 to your computer and use it in GitHub Desktop.
Save davepape/9936615 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# Simple CGI python script that generates a web page dynamically
print '''Content-type: text/html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>web page</title>
</head>
<body>
<p>
Hello, world
</p>'''
import random
x = random.uniform(1,100)
print '<p>Your lucky number is %d.</p>' % x
print '''<p>
<a href="http://validator.w3.org/check?uri=referer">[validate html]</a>
</p>
</body>
</html>
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment