#配置终端,在终端上运行//注意下方Usage和Options中间要换行,避免解析不了
"""ATM
Usage:
ATM start
Options:
"""
from docopt import docopt
if __name__ == '__main__':
arguments = docopt(__doc__)
password = ['123', '111', '222', '333', '555']
while True:
user_pass = input("请输入密码:")
if user_pass in password:
server = input('请输入需要提供的服务(取款,查询余额,存款):')
while True:
if server == '取款':
while True:
money = int(input('请输入取款金额:'))
if money % 100 == 0:
print('取款成功,本次取款金额%d元' % (money))
break
else:
print('取款失败,取款金额必须是100的整数')
break
elif server == '查询余额':
print('您当前账户的余额为10000000000元人民币')
break
elif server == '存款':
print('本次存款成功')
break
else:
print('该ATM机暂未开通本次服务,请重新输入')
else:
"""ATM
Usage:
ATM start
Options:
"""
from docopt import docopt
if __name__ == '__main__':
arguments = docopt(__doc__)
password = ['123', '111', '222', '333', '555']
while True:
user_pass = input("请输入密码:")
if user_pass in password:
server = input('请输入需要提供的服务(取款,查询余额,存款):')
while True:
if server == '取款':
while True:
money = int(input('请输入取款金额:'))
if money % 100 == 0:
print('取款成功,本次取款金额%d元' % (money))
break
else:
print('取款失败,取款金额必须是100的整数')
break
elif server == '查询余额':
print('您当前账户的余额为10000000000元人民币')
break
elif server == '存款':
print('本次存款成功')
break
else:
print('该ATM机暂未开通本次服务,请重新输入')
else:
print('输入密码不正确,请重新输入!')
运行结果截图:
总结:配置完终端后,只能在终端上运行,在Pycharm上运行不了。