12345678910111213141516171819202122232425262728293031323334 |
- import json;
- import time;
- html = open("D:/test/airasia/airasiaRate").read()
- htmlJson = json.loads(html);
- ExternalRateLists = htmlJson["ExternalRateList"];
- ExchangeRateEntitys = [];
- for ExternalRateList in ExternalRateLists:
- baseCurrency = ExternalRateList["quotedCurrency"];
- transactionCurrency = ExternalRateList["collectedCurrency"];
- curDate = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()));
- exchangeRate = ExternalRateList["exchangeRate"];
- updateDate = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()));
- source =1;
- ExchangeRateEntity = {
- "baseCurrency":baseCurrency,
- "curDate":curDate,
- "transactionCurrency":transactionCurrency,
- "exchangeRate":exchangeRate,
- "updateDate":updateDate,
- "source":source
- }
- ExchangeRateEntitys.append(ExchangeRateEntity);
- print(ExchangeRateEntitys)
|