I am looking for a more elegant way to do the following:
py_loglevel = logging.DEBUG
if self.loglevel == "INFO":
py_loglevel = logging.INFO
elif self.loglevel == "WARNING":
py_loglevel = logging.WARNING
elif self.loglevel == "ERROR":
py_loglevel = logging.ERROR
This works of couse, but it somehow annoys me because it is cluttering my code and is attracting my attention even though it is really trivial. Can this be done in a oneliner?