daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import importlib
  2.  
  3. map = {
  4.     'name1': ('package.module1', 'Class1'),
  5.     'name2': ('module2', 'Class2'),
  6. }
  7.  
  8.  
  9. def get_class(name):
  10.     class_path_tuple = exchange_api_map[name.lower()]
  11.     return getattr(importlib.import_module(class_path_tuple[0]), class_path_tuple[1])
RAW Paste Data
Top