Created
February 12, 2023 11:40
-
-
Save ckocyigit/967beab50364edc4be88df9a7d876820 to your computer and use it in GitHub Desktop.
AZAD's Python file to sum up total amount for amazon orders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob, csv | |
| sum: float = 0 | |
| orders: int = 0 | |
| for file in glob.glob("*.csv"): | |
| with open(file, 'r') as input: | |
| csvInput = csv.DictReader(input) | |
| for row in csvInput: | |
| if 'SUBTOTAL' in row['total']: | |
| continue | |
| price = row['total'] | |
| price = price.replace('€','') | |
| if len(price) >= 8: | |
| price = price.replace('.','') | |
| price = float(price.replace(',','.')) | |
| else: | |
| price = float(price.replace(',','.')) | |
| sum += price | |
| orders = orders +1 | |
| #print(price) | |
| print(f'Du hast für {orders} Bestellung {sum}€ ausgegeben') | |
| print(f'Durchnittlich macht das {sum/orders}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment