As said in the official documentation, in Python when calling the function index
on a String
index raises ValueError when x is not found in s
I know we can test the existence of a char in a String simply like this 'c' in String
, but it makes the syntax kind of akward.
Is there any known implementation of the function index
that would return a -1 or such an error code instead of raising an Error