Defining multiple options for a key in python configparser

332 Views Asked by At

What's the best way to define the possible values a parameter/argument may have? Given the config file below, I'm defining the value 'a' for the method argument. Is it possible to define that the other possible options would be 'b' or 'c' without processing it after importing the configs? (i.e. without importing the parameters and checking if 'method' is either 'a', 'b', or 'c' posthoc?

Please note that here I'm not saying the same argument/key can have multiple values.

[defaults]
method = 'a' # possible options are ['a','b','c']
0

There are 0 best solutions below