find() a larger string within a smaller string
John Machin
sjmachin at lexicon.net
Fri Nov 14 14:47:08 EST 2008
On Nov 15, 6:20 am, korean_dave <davidrey... at gmail.com> wrote:
> stringa = "hi"
> stringb = "hiyoooo"
>
> I'd like it to return -1 when I do:
>
> returnVal = stringa.find(stringb);
>
> Instead, it treats stringa as "hi" and stringb as "hi".
You appear to be gravely mistaken:
| >>> stringa = "hi"
| >>> stringb = "hiyoooo"
| >>> returnVal = stringa.find(stringb);
| >>> returnVal
| -1
> How do I solve this?
You need to tell us why you thought so; then, maybe, we can help.
More information about the Python-list
mailing list