A custom_string
input given is alphanumeric input.
If i
from the for loop happens to be a number in any iteration, then one among the custom functions that is written inside another python file letterMatrix
as def num_0: (....) def num_1: (....) def num_2: (....)
is called based on the value of the variable i
I cannot call that custom function (say) num_0
(when i == 0) like how I have, in the last line.
How can I call that letterMatrix.num_1()
(say i == 1) based on the value in variable i
import letterMatrix
others = {0 : 'num_0', 1 : 'num_1', 2 : 'num_2', 3 : 'num_3', 4 : 'num_4', 5 : 'num_5', 6 : 'num_6', 7 : 'num_7', 8 : 'num_8', 9 : 'num_9'}
for i in custom_string:
if i.isnumeric():
others[letterMatrix.i](self.font_size, self.character, row)
I see this ```TypeError: 'str' object is not callable``` when ```others = {'0' : 'num_0'}``` and ```NameError: name 'num_0' is not defined``` with ```others = {0 : num_0}``` – Shashank Raj Feb 04 '21 at 16:27