Can't get around "IndexError: list index out of range"
Gabriel Genellina
gagsl-py at yahoo.com.ar
Fri Oct 6 21:23:58 EDT 2006
At Friday 6/10/2006 20:57, erikcw wrote:
>I ended up using len(sys.argv) > 1 for this particular problem. But I
>think slicing is closer to the tool I was looking for.
>
>I found a.has_key(k) or "k in a" for dictionaries - but haven't found
>anything similar for lists. Does it exist?
if 2 in [1,2,3]: print "Use the same (in) operator"
elif 'E' in ('E','r','i','k'): print "Works for any sequence"
elif 'o' in 'hello': print "Even strings"
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list