str.maketrans() can create a translation table, which makes this look cleaner fyi. https://docs.python.org/3/library/stdtyp....maketrans
>>> translator = str.maketrans({ ... '[': '(', ... ']': ')', ... ';': ',' ... }) >>> "[-31; -52]".translate(translator) '(-31, -52)'