list prob

Gonçalo Rodrigues op73418 at mail.telepac.pt
Tue May 21 19:38:15 EDT 2002


On Tue, 21 May 2002 23:48:41 +0200, "kemu" <kemusoft at hotmail.com> wrote:

>I want to search a list if I do list.index("word to search") and the word
>isn't in the list I get an error I don't want to get one from python but
>want my own error like word is not in the list how ?
>or is there an other way to search the list for strings and if he doesn't
>find one he doesn't print an error ?
>

Let me add that using the find method also works. But the try block
idiom is useful for a lot of thing and is worth learning/understanding.

Best,
Gonçalo Rodrigues



More information about the Python-list mailing list