From 6e3a1a3d3603e1a813183a8441d5a5dcac14d3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1=C4=8Dek?= Date: Wed, 20 Apr 2022 08:59:12 +0200 Subject: [PATCH] +420 --- ucetnictvi_tm.py | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) 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: