On Thu, Jul 30, 2009 at 3:04 PM, srinivasan srinivas <
sri_anna...@yahoo.co.in> wrote:
> Hi,
> I would like to know if i have an object and one of its methods as a
> string. How to call the method using this string?
> For ex
> If object is x and string y has one of its method names.
> x.value(y)()
>>> import math
>>> getattr(math, 'hypot')(3,4)
5.0
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I would like to know if i have an object and one of its methods as a string.
How to call the method using this string?
For ex
If object is x and string y has one of its method names.
x.value(y)() ---. Is there a way to do this?
Thanks,
Srini
See the Web's breaking stories, chosen by