try:
b = a[4]
except IndexError:
b = 'sss'
A cleaner way (only works if you're using a dict):
b = a.get(4,"sss") # exact same thing as above
Here's another way you might like (again, only for dicts):
b = a.setdefault(4,"sss") # if a[4] exists, returns that, otherwise sets a[4] to "sss" and returns "sss"