Search in textfiles?
Martin Johansson
045521104 at telia.com
Mon May 14 04:00:58 EDT 2001
import string
word = raw_input("Write a word ")
c=open('10 Maj 08_580,2183,106_nyheter_1022,00.html.txt', 'r')
textstring = c.read()
index = string.find(textstring, word)
if index > 0:
print "yes the word exists in the textfile"
else:
print "it doesn´t exist"
this code I rote, but what can be done if big letters should not be threated
different than small letters?
(Martin should be the same as martin)
Martin Johansson
pt00mjo at student.bth.se
More information about the Python-list
mailing list