Tim Chase wrote:
(snip)
> starLines = [line for line in p.readlines() if line.startswith("*")]

files are iterators, so no need to use readlines() (unless it's an old
Python version of course):

starLines = [line for line in p if line.startswith("*")]

> or you may optionally want to prune of the "\n" characters in the process:
> 
> starLines = [line[:-1] for line in p.readlines() if line.startswith("*")]

*please* use str.rstrip() for this:
starLines = [line.rstrip() for line in p if line.startswith("*")]

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to