diff --git a/ucetnictvi_tm.py b/ucetnictvi_tm.py index 295e6ed..49afb3d 100644 --- a/ucetnictvi_tm.py +++ b/ucetnictvi_tm.py @@ -168,7 +168,31 @@ with open(FILE, newline='', encoding="utf-8") as csvfile: #try: - #print(dictionary[436761890319959]) #one with both types +with open('output_TMCZ_'+ext_date_from_filaname, 'w') as f: + + writer = csv.writer(f) + writer.writerow(["MSISDN","ICCID","IMSI","DATA-PRICE","DATA-AMOUNT","SMS-PRICE","SMS-COUNT","OTHER-PRICE","SIM-STATUS"]) + for key in dictionary.keys(): + print(key) + print(dictionary[key]) + data = dictionary[key]['data'] + sms = dictionary[key]['sms'] + other = dictionary[key]['other'] + smscount = dictionary[key]['smscount'] + dataamount = dictionary[key]['dataamount'] + dataamount = dictionary[key]['dataamount'] + + + + + writer.writerow(["420"+str(key), "N/A", "N/A", data, dataamount, sms, smscount, other, "N/A"]) + + + + +f.close() + +#[436761890319959]) #one with both types #except: #print("Required unit is not in our set") #sys.exit(1) @@ -183,29 +207,6 @@ print("Count of units: ", len(dictionary.keys())) -with open('output_TMCZ_'+ext_date_from_filaname, 'w') as f: - - writer = csv.writer(f) - writer.writerow(["MSISDN","ICCID","IMSI","DATA-PRICE","DATA-AMOUNT","SMS-PRICE","SMS-COUNT","OTHER-PRICE","SIM-STATUS"]) - for key in dictionary.keys(): - print(key) - print(dictionary[key]) - data = dictionary[key]['data'] - sms = dictionary[key]['sms'] - other = dictionary[key]['other'] - smscount = dictionary[key]['smscount'] - dataamount = dictionary[key]['dataamount'] - - - - - writer.writerow([key, "N/A", "N/A", data, dataamount, sms, smscount, other, "N/A"]) - - - - -f.close() - with open('output_TMCZ_'+ext_date_from_filaname, "rb") as f: