#!/usr/bin/env python # Do whatever you want to. You may even claim you wrote this, if you want. # -- Seo Sanghyeon preference = """perl python ruby""".split() template = "http://pleac.sourceforge.net/pleac_%s/%s.html#AEN%d" langs = """perl python ruby guile merd ada tcl haskell java pliant ocaml commonlisp c++ pike erlang forth php masd nasm""".split() chapters = """strings numbers datesandtimes arrays hashes patternmatching fileaccess filecontents directories subroutines referencesandrecords packagesetc classesetc dbaccess userinterfaces processmanagementetc sockets internetservices cgiprogramming webautomation""".split() start_at_one = 2, 15, 16, 18 bases = (14, 73, 132, 170, 232, 285, 359, 430, 495, 536, 592, 642, 704, 754, 792, 851, 919, 978, 1007, 1054) def geturl(lang, chapter, section): pagename = chapters[chapter-1] if chapter in start_at_one: section -= 1 tag = bases[chapter-1] + 3 * section url = template % (lang, pagename, tag) return url import cgi form = cgi.FieldStorage() chapter = form.getvalue("chapter") section = form.getvalue("section") import cgitb cgitb.enable() print "Content-Type: text/html" print print """
| """ % url if not left: print """ |