我一直在尝试构建一个函数来解释命令行输入,然后使用提供的参数从脚本文件中运行适当的函数。此函数中包含一个用于关闭交互层的转义命令。仅当用户输入“退出”或“结束”时,才应激活此转义命令。但是,由于某种原因,无论输入什么都会触发。我难住了。你们有什么想法吗?
verinfo ()
x = True
while x is True:
print ('Please seperate arguments with a comma.')
inputstring = input('->')
#format input string to a standard configuration
#expected is command,arg1,arg2,arg3,arg4,arg5
procstring = inputstring.split (',')
while len(procstring) < 6:
procstring.append('')
print (procstring)
#escape clause
print (procstring[0])
if procstring[0] is 'end' or 'exit':
print ('Closing')
x = False
break
elif procstring[0] is 'help' or 'Help':
Help ()
else:
print ('command invalid. List of commands can be accessed with "help"')
MM们
GCT1015
相关分类