當我使用命令來終止程序,它並沒有終止,而是假定我想,當我說「不」 這裏是我的代碼來打開另一個程序:我的Python程序不會正確終止?
import getpass
print 'Hello', getpass.getuser(), ', welcome!'
do = raw_input ('What program would you like to open? ')
if do.lower() == 'browser' or 'internet' or 'Chrome' or 'Google chrome':
import webbrowser
webbrowser.open ('www.google.com')
oth = raw_input ('Are there any others? ')
if oth.lower() == 'yes' or 'ye' or 'yeah':
oth2 = raw_input ('Please name the program you would like to open! ')
else:
import sys
sys.exit()
在選項的「元組」中; ^) – mgilson 2012-07-12 14:58:29