coplete automation of input files and outputs
This commit is contained in:
@@ -4,8 +4,22 @@ import csv
|
||||
from datetime import datetime
|
||||
import sys
|
||||
from pprint import pprint
|
||||
import os
|
||||
from discord_webhook import DiscordWebhook
|
||||
|
||||
FILE = 'TMCZ202110.csv'
|
||||
|
||||
webhook = DiscordWebhook(
|
||||
url='https://discordapp.com/api/webhooks/744608404848246926/FwwWUNmuWsCetFDBOcA1trCx6nSflI0yX3f9BNh7-oB5a2VYSLl882di23XK2TNWwQxP',
|
||||
username="billing tmcz")
|
||||
|
||||
|
||||
|
||||
|
||||
FILE = [filename for filename in os.listdir(dirpath) if filename.startswith("TMCZ_")]
|
||||
FILE = FILE[0]
|
||||
|
||||
ext_date_from_filaname = FILE.split('_')[-1]
|
||||
print(ext_date_from_filaname)
|
||||
|
||||
usrmonth = input("Month to be processed: ")
|
||||
usrmonth = int(usrmonth)
|
||||
@@ -138,15 +152,11 @@ with open(FILE, newline='', encoding="utf-8") as csvfile:
|
||||
|
||||
print("Count of units: ", len(dictionary.keys()))
|
||||
|
||||
with open('export_tm202110v1.csv', 'w') as f:
|
||||
for key in dictionary.keys():
|
||||
f.write("%s,%s\n"%(key,dictionary[key]))
|
||||
|
||||
|
||||
|
||||
csv_columns = ['takhleuztoneudelam', 'data', 'sms', 'other', 'smscount']
|
||||
try:
|
||||
with open('export_tm_202110v1.csv', 'w') as csvfile:
|
||||
with open('output_TMCZ_'+ext_date_from_filaname, 'w') as csvfile:
|
||||
w = csv.DictWriter(sys.stdout, csv_columns)
|
||||
for key, val in sorted(dictionary.items()):
|
||||
row = {'takhleuztoneudelam': key}
|
||||
|
||||
Reference in New Issue
Block a user