BartlebyScrivener wrote: > Saint Malo wrote: > > If the program searches for blue, i just want it to print blue > > Huh? Tell it to print whatever you want. > > for line in file: > if 'blue' in line: > print 'blue' > > for line in file: > if 'brown' in line: > print 'brown' > > for line in file: > if 'red' in line: > print 'weasels rip my flesh'
wow Dude, this is not efficient at all! You only need to read the file once not as many times as there are words in your looking for in the lines of the file -- http://mail.python.org/mailman/listinfo/python-list