ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Redgrave/ConcordanceDatToDictionary.py
Revision: 938
Committed: Wed Sep 3 20:36:31 2025 UTC (6 months, 3 weeks ago) by nino.borges
Content type: text/x-python
File size: 938 byte(s)
Log Message:
This program will take a DAT export from Relativity and will return a dictionary where the column names are the keys.

File Contents

# User Rev Content
1 nino.borges 938 """
2    
3     ConcordanceDatToDictionary
4    
5     Created by:
6     Emanuel Borges
7     09.03.2025
8    
9     This program will take a DAT export from Relativity and will return a dictionary where the column names are the keys.
10    
11     """
12    
13     import csv
14    
15    
16     class ConcordanceLoader:
17     def __init__(self, filePath):
18     self.filePath = filePath
19     self.delimiter = '\x14' # ASCII 20
20     self.quotechar = '\xfe' # ASCII 254
21     self.records = []
22    
23    
24     def load(self):
25     with open(self.filePath, 'r', encoding='utf-8', newline='') as file:
26     reader = csv.reader(file, delimiter = self.delimiter, quotechar = self.quotechar)
27     self.records = [row for row in reader]
28    
29    
30     def get_headers(self):
31     return self.records[0] if self.records else []
32    
33     def get_data(self):
34     return self.records[1:] if len(self.records) >1 else []
35    
36     def get_all(self):
37     return self.records
38    
39    
40    
41    
42    
43    
44    
45