Credit Card Trading System Python

Source: Internet
Author: User

#!/usr/bin/env python#--*--coding:utf-8--*--
function Body of #safe_float
defsafe_float (obj):'safe version of float ()' Try: retval=float (obj)except(Valueerror,typeerror), Diag:retval=Str (DIAG)returnretvaldefMain ():'handles all the data processing'Log= Open ('Cardlog.txt','W') #记录logTry: Ccfile= Open ('Carddata.txt','R') exceptIoerror,e:log.write ('no Txns this month\n') Log.close ()returnTxns=ccfile.readlines () ccfile.close () Total= 0.00Log.write ('Account log:\n') forEachtxninchTxns:result=safe_float (EACHTXN)ifisinstance (result,float): #检查是否为float Total+=result Log.write ('data ... processed\n') #写入Else: Log.write ('ignore:%s'%result)Print '$%s.2f (New Balance)'%(total) log.close ()if __name__=='__main__': Main ()

Credit Card Trading System Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.