python break练习_实现命令行提示符雏形
# 倒入os模块
import os
#for i in range(100):
# 死循环
while True:
cmd = input("[[email protected] ]$ ")
if cmd:
if cmd == 'exit':
print('logout')
break
print("hello") # 不会执行
else:
print("run %s" %(cmd))
# 运行shell命令
os.system(cmd)
else:
continue
print("hello") # 不会执行的