我是Python新手Python if语句
我有一个if: else
语句。
我的问题:现在打印“欢迎使用脚本”后,我的脚本退出,但我想恰好在其退出后,其他还当我的情况是真实的继续行name=raw_input("Enter your name: ")
等不退出...
我该如何退出if else并继续执行脚本?
script_username="test"
script_password="1"
login_username=raw_input('Please Enter the script username:')
login_password=getpass.getpass('Please Enter the script password:')
if login_password == script_password and login_username == script_username:
print "Welcome to the Script"
else:
print "your Username or Password is false"
exit()
name=raw_input("Enter your name: ")
family=raw_input("Enter your family: ")
sex=raw_input("Enter your Sex: ")
print "hello " + sex + name + family
raw_input("press<enter>")
请缩进代码正确 – shaktimaan
的Python取决于缩进知道你的脚本的块结构如果你没有正确缩进,它不会工作 – Barmar
真的?哦,非常感谢 – Farsanet