finding a substring

ian iwaters at btclick.com
Mon May 20 12:14:28 EDT 2002


cheers that sorted it!


"ian" <iwaters at btclick.com> wrote in message
news:cB6G8.72053$7R.78769 at NewsReader...
>
> hi im writing the a spam checking routine for
> my mail server and i having basic problems
> checking for a sub string in the message
>
> the MESSAGE var is a line from a socket
> and the line var is a line from a file
> the routine wont find any substrings
>
> any help would be great
> cheers
>
> print "Checking against spam file"
>    sfile = file('spam.txt','r',1024)
>
>    while 1:
>     line = sfile.readline(1024)
>     if line == '':break
>     else:
>      print MESSAGE
>      errorval = MESSAGE.find(line)
>      print str(errorval)
>      if errorval == -1:
>       print "Message OK"
>      else:
>       print "Message not OK"
>
>                                 print line
>    sfile.close()
>
>
>





More information about the Python-list mailing list