Turn string into function call

Grant Edwards grante at visi.com
Fri Mar 8 14:15:48 EST 2002


In article <1f5252d4.0203080545.3861adec at posting.google.com>, N Becker wrote:

> What's the best way to turn a string naming a function into a function call?
> 
> I used this:
> eval (funcname + '()')

This really ought to go into the FAQ.  It's been asked (and
answered) at least 3 times in the past week or so.

-- 
Grant Edwards                   grante             Yow!  Yow!! That's a GOOD
                                  at               IDEA!! Eating a whole FIELD
                               visi.com            of COUGH MEDICINE should
                                                   make you feel MUCH BETTER!!



More information about the Python-list mailing list