I'm trying to check if an array index exist, however it keeps failing for me.
if my_list[foo] == 1:
It breaks if there's no element at foo yet. Can I test for it somehow? I tried
if my_list[foo] == None:
but that doesn't work either. In C I used to check if the array index is NULL, not sure about python.
Thanks for your help!
if my_list[foo] == 1:
It breaks if there's no element at foo yet. Can I test for it somehow? I tried
if my_list[foo] == None:
but that doesn't work either. In C I used to check if the array index is NULL, not sure about python.
Thanks for your help!