Submit and Succeed: Difference between revisions
Line 53: | Line 53: | ||
* Mirjam - [http://pzwart3.wdka.hro.nl/~mdissel/cgi-bin/domestic_violence_replacer.cgi a story about domestic violence (for children)] | * Mirjam - [http://pzwart3.wdka.hro.nl/~mdissel/cgi-bin/domestic_violence_replacer.cgi a story about domestic violence (for children)] | ||
* Lieven - [http://pzwart3.wdka.hro.nl/~lspeybroeck/cgi-bin/regexp.cgi Once upon a time they lived happily together] | * Lieven - [http://pzwart3.wdka.hro.nl/~lspeybroeck/cgi-bin/regexp.cgi Once upon a time they lived happily together] | ||
* Silvio - [[ | * Silvio - [[http://pzwart3.wdka.hro.nl/~slorusso/cgi-bin/codeis-concrete-poetry.cg Code Is (Concrete) Poetry]] |
Revision as of 17:47, 17 November 2011
- Charles Hayden's Eliza: http://chayden.net/eliza/Eliza.html
- Regular Expressions in Python: http://docs.python.org/library/re.html
Some examples of regular expressions
- Forms in HTML: http://www.w3.org/TR/html4/interact/forms.html
Behold the self-posting form:
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import cgi
import cgitb; cgitb.enable()
query = cgi.FieldStorage()
text = query.getvalue("text", "")
## Alter text here
import re
text = re.sub(r"and (\w+)", r"and \1 and peanuts", text, flags = re.I)
print "Content-type: text/html"
print
print """
<html>
<head>
<style>
textarea {{
font-size: 32px;
width: 100%;
border: 4px solid black;
height: 400px;
}}
</style>
</head>
<body>
<form action="">
<textarea name="text">{0}</textarea>
<input type="submit">
</form>
</body>
</html>
""".format(text)
Afternoon Tutorial
- Eleanor
List of people's work today
- Mirjam - a story about domestic violence (for children)
- Lieven - Once upon a time they lived happily together
- Silvio - [Code Is (Concrete) Poetry]