[Tutor] Calling functions using a variable name .. ??

Graeme Andrew glide@slingshot.co.nz
Tue, 16 Jul 2002 20:11:46 +1200


Hi All,

Sorry another newbie question !!

I am wanting to execute functions based on the names of functions read ou=
t of=20
a configuration file and assigned to a variable.

I guess something like this ...

f =3D open(myfile_file, 'r')
# read all the lines into a list
my_list=3Df.readlines()
#the list holds the names of all the functions I want to execute ...
my_function =3D my_list[n]
exec my_function()

=2E... is this possible ? =20

Thanks in advance

Regards
Graeme Andrew
=20