In the Python spirit of “ask for forgiveness, not permission”, here’s one way:
try:
b = a[4]
except IndexError:
b = 'sss'
In the Python spirit of “ask for forgiveness, not permission”, here’s one way:
try:
b = a[4]
except IndexError:
b = 'sss'