while True:
op_list = []
for op in client.longPoll():
op_list.append(op)
for op in op_list:
sender = op[0]
receiver = op[1]
message = op[2]
msg = message.text
if msg("help"):
receiver.sendMessage('why?')
if msg("help"):
TypeError:'str'對象不可調用,任何人都可以幫我嗎?TypeError:'str'對象不可調用di python 2.7
這不能是正確的格式。 「雖然是真的:」什麼?沒有? –
味精(「幫助」)幾乎肯定是你的問題 - message.text是一個字符串,你試圖用參數「help」來調用它。如果你想檢查它是否相等,做msg ==「help」 – James
這段代碼沒有正確縮進,請修復它,以便我們可以專注於你的主要問題。你希望msg(「help」)做什麼? –