str.find for multiple strings

Peter Hansen peter at engcorp.com
Wed Feb 11 17:16:37 EST 2004


Bart Nessux wrote:
> 
> Peter Hansen wrote:
> > Bart Nessux wrote:
> >
> >>x = str.find(temp, '120.50')
> >>
> >>I am looking for '120.50' '120.51' '122.78' etc. How can I do this with
> >>just one str.find... I can use re if I must, but I'd like to avoid it if
> >>possible.
> >
> > In addition to Fecundo's questions, here's another.  What does "temp"
> > contain?  A single temperature string, or a temperature embedded in
> > a bunch of other stuff, or a whole series of temperatures, or what?
> >
> > -Peter
> 
> Here's what I'm doing
> 
>     inputFile = file('ath_ips.txt', 'r')
>     data = inputFile.read()
[snip]

Well, since that shows nothing whatever about the content of the 
"data" string (i.e. what is in that ath_ips.txt file), it doesn't
really help to answer the questions I had.

-Peter



More information about the Python-list mailing list