Mega Code Archive

 
Categories / Python Tutorial / Buildin Function
 

Getattr with module

import math print math.abs print getattr(math, "abs")    object = math method = "abs"  print getattr(object, method)                        print type(getattr(object, method))