python:TypeError :()只取1个参数(给定0)

时间:2017-10-23 09:26:29

标签: python python-2.7

##    Flag = Check_InActive()
## TypeError: Check_InActive() takes exactly 1 argument (0 given)

有人可以帮我解决错误。

    ws.protection.sheet = True

2 个答案:

答案 0 :(得分:1)

您应该为该功能提供参数,并且您不需要此通话Check_InActive(Policy),因为您不会存储结果

Policy = raw_input("Enter Policy Name: ")  
Check_InActive(Policy)  
Flag = Check_InActive(Policy)  
if (Flag in "Inactive"):  
    print(Policy,"is ",Flag) 

答案 1 :(得分:1)

您需要将参数传递给Check_InActive功能区。你应该这样称呼它:

Policy = raw_input("Enter Policy Name: ")    
Flag = Check_InActive(Policy)  
if (Flag in "Inactive"):
    print(Policy,"is ",Flag)