Files

20 lines
602 B
Python
Raw Permalink Normal View History

2026-02-25 10:24:12 +01:00
from pprint import pprint
import csv
from localconfig import OFFICESFILE
class Offices():
def __init__(self):
'''
Get the country - office detail from disk
'''
self.offices = {}
with open(OFFICESFILE, newline="", encoding="utf-8") as f_in:
reader = csv.DictReader(f_in)
for row in reader:
self.offices[row['Country']] = row
def get_office_details(self, country):
if country in self.offices.keys():
return self.offices[country]
return {'Name': '?', 'PartyId':'?', 'City': '?'}