possibleRequests = ['test', 'test1']
def inboxReader():
global inbox
tempInbox = []
tempInbox = inbox.inboxMessage #inboxMesage remains filled?
print(inbox.inboxMessage, 'inboxReader')
i = 0
while (i < len(tempInbox)):
if (tempInbox[i] in possibleRequests):
print('THIS IS WORKING')
#print(i)
i+=1
我希望能够让可能的请求指向要运行的方法,而不是一长串if语句。我能做些什么来让一个变量指向并运行一个方法
干杯
马克
您可以先创建一个函数字典,然后用tempInbox[i]引用它。示例代码如下:
相关问题 更多 >
编程相关推荐