Need to call functions/class_methods etc using string ref :How

Donn Ingle donn.ingle at gmail.com
Mon Nov 26 05:52:23 EST 2007


Well, I don't know all the answers, but you can start here:

def boobs(): print "Oohh little birds!"
b="boobs"
>>>eval(b)()
Ohhh little birds!

Naturally, eval is going to run anything... Even code to format your drive.

HTH
\d




More information about the Python-list mailing list