Newbie question on Re module
Peter Hansen
peter at engcorp.com
Sat Jan 4 10:46:33 EST 2003
Tom Zych wrote:
>
> Andrew McGregor wrote:
> > if str.index('binaries') == -1:
> > # then str did not contain the word.
>
> Python 2.2 doesn't return -1 when string.index fails; it raises
> a ValueError exception. Are there older versions of Python that
> return -1?
He posted untested code. He meant "str.find('binaries') == -1".
.index() has probably always returned ValueError.
-Peter
More information about the Python-list
mailing list