def fetcher(obj,index): return obj[index] s= "hello" try: print s[8] print "hh" except IndexError: print 'index out of range try another number' print "www"