an apply question
Alan Marchand
malan at club-internet.fr
Tue Dec 5 18:11:11 EST 2000
In Python 2.0:
What am I doing wrong?
#!/bin/env python
#############
MyMap = {
'Key1' : 'func1',
'Key2' : 'func2',
'Key3' : 'func3',
'Key4' : 'func4'
}
def func1 ( ):
print "Here's func1"
items = MyMap.items( )
for x in range( len(items) ):
key, func = items[x]
if key == "Key3":
apply( func, ( ) )
-------------------------
c:\devpy\python test.py
Traceback (most recent call last):
File "test.py", line 17, in ?
apply( func, ( ) )
TypeError: Call of non-function (type string)
Thanks.
Alan.
More information about the Python-list
mailing list