Python Else语句返回到原始脚本
我正在使用Python和SQLite编写一个登录脚本,我刚刚遇到了一个奇怪的错误 这是我得到的代码:Python Else语句返回到原始脚本,python,sqlite,if-statement,Python,Sqlite,If Statement,我正在使用Python和SQLite编写一个登录脚本,我刚刚遇到了一个奇怪的错误 这是我得到的代码: while c.fetchone() is not None: if oper in ["3350",""]: print(term.move(28,1)) time.sleep(3) os.system("python /SABB/app1.py") elif oper == "1010": os.system(
while c.fetchone() is not None:
if oper in ["3350",""]:
print(term.move(28,1))
time.sleep(3)
os.system("python /SABB/app1.py")
elif oper == "1010":
os.system("python /SABB/app2.py")
if oper == "/":
sys.exit()
else:
main('self')
它验证用户名和密码,并根据键入的“oper”打开任何一个正常工作的可用应用程序
但else的说法似乎造成了一个问题。当用户退出应用程序时,它们将被发送回登录脚本。与代码相同的行为是:
else:
os.system("python /SABB/app1.py")
main('self')
有什么想法吗
[编辑]以下是完整的脚本:对于任何与我有相同问题的人,我通过将“os.system”替换为“subprocess.call”来调用外部脚本,从而解决了这个问题
希望有帮助!:D主要功能的定义在哪里?@YCFlame我刚刚编辑了这个问题,并添加了完整脚本的链接。