str.find for multiple strings

Peter Hansen peter at engcorp.com
Thu Feb 12 13:26:47 EST 2004


Peter Hansen wrote:
> 
> 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?

Ah, trust me to take an industrial-control point of view and not a network
software point of view.  You meant "temp" to be a temporary variable, not
a temperature, and the 120.50, 120.51 stuff are partial IP addresses, not
temperatures...  how curious of me to confuse them. :-)

-Peter



More information about the Python-list mailing list