| 1 |
nino.borges |
797 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
NTRS-TopSenderAnalysis
|
| 4 |
|
|
|
| 5 |
|
|
Created by:
|
| 6 |
|
|
Emanuel Borges
|
| 7 |
|
|
09.20.2023
|
| 8 |
|
|
|
| 9 |
|
|
Very simple program that will read multiple CSV files and export a report based on LanID and other general information.
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
import csv, os
|
| 14 |
|
|
|
| 15 |
|
|
if __name__ == '__main__':
|
| 16 |
|
|
startDir = r"C:\Users\eborges\Documents\Cases\Northern Trust"
|
| 17 |
|
|
test = []
|
| 18 |
|
|
|
| 19 |
|
|
|
| 20 |
|
|
for (root,dirs,files) in os.walk(startDir):
|
| 21 |
|
|
for fl in files:
|
| 22 |
|
|
with open(os.path.join(root,fl),mode='r',encoding='ANSI') as csv_file:
|
| 23 |
|
|
csv_reader = csv.DictReader(csv_file)
|
| 24 |
|
|
for row in csv_reader:
|
| 25 |
|
|
test.append(row['To'])
|
| 26 |
|
|
print(len(test))
|
| 27 |
|
|
|
| 28 |
|
|
## Initially gathering some very basic information across the CSV files, not using csv lib
|
| 29 |
|
|
# for (root,dirs,files) in os.walk(r"C:\Users\eborges\Documents\Cases\Northern Trust"):
|
| 30 |
|
|
# for fl in files:
|
| 31 |
|
|
# contents = open(os.path.join(root,fl), encoding='ANSI').readlines()
|
| 32 |
|
|
# print(f"{fl}|{len(contents)-1}") |