Search in textfiles?

Roman Suzi rnd at onego.ru
Mon May 14 04:29:58 EDT 2001


On Mon, 14 May 2001, Martin Johansson wrote:

What about using module re?

> 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

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 





More information about the Python-list mailing list