If you wish to apply a method or function call that is currently in string format (e.g., you got an option with optparse) and wish to apply that method or function to another string, use getattr.
getattr(your_string, method_you_want_to_apply)()The parentheses at the end apply the function or method rather than merely trying to obtain the attribute.