Skip to content

Instantly share code, notes, and snippets.

@nathanhere
Created May 15, 2013 06:33
Show Gist options
  • Save nathanhere/5582019 to your computer and use it in GitHub Desktop.
Save nathanhere/5582019 to your computer and use it in GitHub Desktop.
List current directory contents in web browser (for Koding.com)
#!/usr/bin/python
# Make sure file permission is set so that Owner, Group, and Everyone can EXECUTE.
# Otherwise server error
import os
import platform
print "Content-Type: text/html"
print
print """\
<!DOCTYPE html>
<html lang="en">
<head> <meta charset="utf-8">
<title>Hello World from Python</title>
</head>
<body>
"""
print os.listdir(os.curdir)
print """\
</body>
</html>
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment