vals = ['a', 'b', 'c', 'd'] pos = input("Get the value at what position? ") try: position = int(pos) value = vals[position] #Different clauses for different errors except ValueError: print('Unable to convert "'+pos+'" into an integer.') position = len(vals)-1 except IndexError: print('Invalid position in list.') #except Exception: # print("Unknown error occurred.") print(position, type(position)) print(value, type(value)) #Combining some except clauses #except (ValueError, IndexError): # print('Error with input.') #except ZeroDivisionError: # print('Cannot divide by zero.') #Catch "generic" exceptions #except Exception: # print("Unknown error occurred.") #except: # print("Unknown error occurred.")