call method by name?

Brian Quinlan brian at sweetapp.com
Thu Jan 24 18:30:00 EST 2002


> How to say this in Python?
> 
> method_name = 'method1'
> a. at method_name()

getattr(a, method_name)()

Cheers,
Brian





More information about the Python-list mailing list