最近alex买了个Tesla Model S,通过转账的形式,并且支付了5%的手续费,tesla价格为95万。账户文件为json,请用程序实现该转账行为。

import os,sys

base_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
sys.path.append(base_dir)
print (sys.path)

print(
'ICBC Bank'.center( 30,'-'),'\n'
'1.账户信息''\n'
'2.转账'
)
alex_money = {'user':'alex',}
def choice(num):
if num == '1':
f = open('../account/alex.json','r')
print (type(f.read()))
elif num == '2':
f = open('../account/alex.json','r')
f2 = open('../account/tesla_company.json','r')
alex_act = int(float(f.read().strip()))-950000*(1+0.05)
tesla_act = int(float(f2.read().strip()))+950000*(1+0.05)
f.close()
f2.close()
f = open('../account/alex.json','w')
f2 = open('../account/tesla_company.json','w')
f.write(str(int(alex_act)))
f2.write(str(int(tesla_act)))

choice1 = input('选择服务:')
choice(choice1)
上一篇:Maven打包报错:[WARNING] The POM for xxx is missing, no dependency inform


下一篇:NVIDIA Tesla/Quadro和GeForce GPU的比较