[Checkins] SVN: z3c.gibberish/trunk/z3c/gibberish/ Strip whiespace
from dictionary lines
Ross Patterson
me at rpatterson.net
Sun Dec 16 23:04:30 EST 2007
Log message for revision 82306:
Strip whiespace from dictionary lines
Changed:
U z3c.gibberish/trunk/z3c/gibberish/README.txt
U z3c.gibberish/trunk/z3c/gibberish/__init__.py
-=-
Modified: z3c.gibberish/trunk/z3c/gibberish/README.txt
===================================================================
--- z3c.gibberish/trunk/z3c/gibberish/README.txt 2007-12-17 03:31:23 UTC (rev 82305)
+++ z3c.gibberish/trunk/z3c/gibberish/README.txt 2007-12-17 04:04:30 UTC (rev 82306)
@@ -44,6 +44,11 @@
>>> len(result[0][0].split())
1
+Make sure that the newline is stripped::
+
+ >>> result[0][0][-1] != '\n'
+ True
+
With two words in the column::
>>> import StringIO, csv
Modified: z3c.gibberish/trunk/z3c/gibberish/__init__.py
===================================================================
--- z3c.gibberish/trunk/z3c/gibberish/__init__.py 2007-12-17 03:31:23 UTC (rev 82305)
+++ z3c.gibberish/trunk/z3c/gibberish/__init__.py 2007-12-17 04:04:30 UTC (rev 82306)
@@ -1,4 +1,4 @@
-import sys, os, random, optparse, csv, itertools
+import sys, os, string, random, optparse, csv, itertools
parser = optparse.OptionParser(
usage="usage: %prog [options] LINES COLUMN [COLUMN ...]",
@@ -37,7 +37,8 @@
while True:
yield itertools.islice(
- words, random.randint(0, length), length).next()
+ words, random.randint(0, length), length
+ ).next().strip()
words.seek(0)
def main():
More information about the Checkins
mailing list