I want to write a function in Python that returns different fixed values based on the value of an input index.
In other languages I would use a switch
or case
statement, but Python does not appear to have a switch
statement. What are the recommended Python solutions in this scenario?
转载于:https://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python