找不到语法错误或编译错误。为什么这个程序不能执行?如果没有编译错误,我无法理解为什么这个程序没有运行。下面的代码在逻辑上会出什么问题? 我可以在这个代码中添加什么使它运行和交互?你知道吗
def main():
print "Checking platform...\r\r\r"
platform = systemdetails()
def systemdetails():
print "Hello! Welcome to the auto-commander"
print "Please enter the platform specific number to automate."
platforminput = integer(input ("1. Cisco 2. Linux/Unix 3. Juniper 4. VMware vSphere/NSX \n:"))
if platforminput ==1:
platform='cisco_ios'
elif platforminput ==2:
platform='linux'
elif platforminput ==3:
platform='juniper'
elif platforminput ==4:
platform='vmware'
else:
print "Commander has to repeat the question...\n\n"
systemdetails()
return platform
您需要调用
main()
函数。你知道吗要么像这样:
main()
或者像这样:
在第二个示例中,只有直接运行程序而不是单独导入模块和运行函数时,才会调用
main()
。这样,您可以导入模块的函数以单独使用,而无需在导入时运行main()。你知道吗您需要调用main函数。一个最简单的例子仍然重现你的问题是
要让它工作,你需要打电话给你的主管
一般来说,如果您没有被导入,您只想调用您的
main
,可以这样做相关问题 更多 >
编程相关推荐