From 5da9535b97e3a0ab54eec166a7d3fdf9c19423cc Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 19 Apr 2018 09:39:11 +0200 Subject: [PATCH] Use ; instead of , in the csv file --- worker.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/worker.py b/worker.py index a876378..20ded2c 100644 --- a/worker.py +++ b/worker.py @@ -1069,25 +1069,25 @@ class ChatWorker(threading.Thread): # Write on the previously created file with open(f"transactions_{self.chat.id}.csv", "w") as file: # Write an header line - file.write(f"UserID," - f"TransactionValue," - f"TransactionNotes," - f"Provider," - f"ChargeID," - f"SpecifiedName," - f"SpecifiedPhone," - f"SpecifiedEmail," + file.write(f"UserID;" + f"TransactionValue;" + f"TransactionNotes;" + f"Provider;" + f"ChargeID;" + f"SpecifiedName;" + f"SpecifiedPhone;" + f"SpecifiedEmail;" f"Refunded?\n") - # For each transaction, write a new line on file + # For each transaction; write a new line on file for transaction in transactions: - file.write(f"{transaction.user_id if transaction.user_id is not None else ''}," - f"{transaction.value if transaction.value is not None else ''}," - f"{transaction.notes if transaction.notes is not None else ''}," - f"{transaction.provider if transaction.provider is not None else ''}," - f"{transaction.provider_charge_id if transaction.provider_charge_id is not None else ''}," - f"{transaction.payment_name if transaction.payment_name is not None else ''}," - f"{transaction.payment_phone if transaction.payment_phone is not None else ''}," - f"{transaction.payment_email if transaction.payment_email is not None else ''}," + file.write(f"{transaction.user_id if transaction.user_id is not None else ''};" + f"{transaction.value if transaction.value is not None else ''};" + f"{transaction.notes if transaction.notes is not None else ''};" + f"{transaction.provider if transaction.provider is not None else ''};" + f"{transaction.provider_charge_id if transaction.provider_charge_id is not None else ''};" + f"{transaction.payment_name if transaction.payment_name is not None else ''};" + f"{transaction.payment_phone if transaction.payment_phone is not None else ''};" + f"{transaction.payment_email if transaction.payment_email is not None else ''};" f"{transaction.refunded if transaction.refunded is not None else ''}\n") # Describe the file to the user self.bot.send_message(self.chat.id, strings.csv_caption)