def main(): try: rate_history = RateHistory(u"配置.ini") print rate_history # return if len(sys.argv) < 2: data_file = raw_input(u"请输入文件名称:".encode('gbk')).decode('gbk') else: data_file = sys.argv[1] if not os.path.isfile(data_file): print u"文件'%s'不存在" % data_file exit(0) balance_list = load_balance_flow(data_file) acc = Account(rate_history) earn = acc.interest(balance_list) open(u"明细.csv", "w").write(str(acc)) print u"余额明细如下\n%s" % acc print u"明细可参考文档'明细.csv'" print u"总利息 %s亿,余额 %s亿" % (earn, acc.total_amount()) print u"计算完成!" except Exception, e: print u"异常:%s" % str(e) traceback.print_tb()