What is wrong in my list comprehension?
hubaghdadi at gmail.com
Sun Feb 1 06:22:36 EST 2009
I have a log file that doesn't contain the word "Haskell" at all, I'm
just trying to do a little performance comparison:
from datetime import time, timedelta, datetime
start = datetime.now()
lines = [line for line in file('/media/sda4/Servers/Apache/
Tomcat-6.0.14/logs/catalina.out') if line.find('Haskell')]
print 'Number of lines contains "Haskell" = ' + str(len(lines))
end = datetime.now()
Well, the script is returning the whole file's lines number !!
What is wrong in my logic?
More information about the Python-list