daily pastebin goal
93%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 46 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top