Guest User

Untitled

a guest
Nov 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  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])
Add Comment
Please, Sign In to add comment