照书敲的,可能以后会用到
《Python编程快速上手》 P41 2.9用sys.exit()提前结束程序
# Python编程快速上手 P41 用sys.exit()提前结束程序
import sys
while True:
print('Type exit to exit.')
resp = input()
if resp=='exit':
sys.exit()
print('You typed '+resp+'.')
照书敲的,可能以后会用到
《Python编程快速上手》 P41 2.9用sys.exit()提前结束程序
# Python编程快速上手 P41 用sys.exit()提前结束程序
import sys
while True:
print('Type exit to exit.')
resp = input()
if resp=='exit':
sys.exit()
print('You typed '+resp+'.')