Last active
September 9, 2022 15:58
-
-
Save richardevs/1bcecba2dbc3760ed26e3988c1408b94 to your computer and use it in GitHub Desktop.
Just a quick script to see how many $ I have been spending on Uber Eats... 😭
This file contains 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
''' | |
Quick Python script to extract my Uber Eats' fee from my banking CSV exports | |
''' | |
import csv | |
import glob | |
''' | |
List all csv files under current directory | |
''' | |
file_names = glob.glob('*.csv') | |
print(file_names) | |
''' | |
For each csv file, search for keywords, and sums up the amounts | |
''' | |
keywords = ['ウーバー', 'UBER'] | |
keyword_column = 1 | |
amount_column = 2 | |
for file in file_names: | |
with open(file, encoding='shift_jis') as f: | |
reader = csv.reader(f) | |
total_a = 0 | |
for row in reader: | |
for k in keywords: | |
if k in row[keyword_column]: | |
total_a += int(row[amount_column]) | |
print("Filename: " + file + " Total amount: " + str(total_a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment