simple problem with lists I am just forgetting

Alexnb alexnbryan at gmail.com
Thu Jul 31 15:51:49 EDT 2008


Lets say we have this list:

funlist = ['a', 'b', 'c']

and lets say I do this:

if funlist[4]:
    print funlist[4]

I will get the exception "list index out of range"

How can I test if the list item is empty without getting that exception?
-- 
View this message in context: http://www.nabble.com/simple-problem-with-lists-I-am-just-forgetting-tp18762181p18762181.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list