2009 210: Difference between revisions

From XPUB & Lens-Based wiki
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
and of course, [[TutorialsMichael | tutorials]]
and of course, [[TutorialsMichael | tutorials]]


[http://en.wikipedia.org/wiki/Comte_de_Lautr%C3%A9amont | Comte de Lautréamont]
[[Unicode]]
 
Text source:
 
* [http://en.wikipedia.org/wiki/Comte_de_Lautr%C3%A9amont Comte de Lautréamont]
* http://www.gutenberg.org/etext/12005
 
<source lang="python">
import re
words = re.split(r"\s+", text)
words = [w for w in words if w]
# print words
# print " ".join( [w.upper().encode("utf-8") for w in words if len(w) == 4] )
print " ".join( [w.lower().encode("utf-8") for w in words if w[0] == "e"] )
</source>

Latest revision as of 12:54, 31 March 2009

Morning

A small CGI exercise using List Comprehensions.

and of course, tutorials

Unicode

Text source:

import re
words = re.split(r"\s+", text)
words = [w for w in words if w]
# print words
# print " ".join( [w.upper().encode("utf-8") for w in words if len(w) == 4] )
print " ".join( [w.lower().encode("utf-8") for w in words if w[0] == "e"] )