You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
801 B
Python
24 lines
801 B
Python
|
|
import os
|
|
import csv
|
|
|
|
FMEA_DATA_DIR = "/home/aimo/dev/be-ircfa/src/root_cause/fmea_data"
|
|
|
|
def check_tsv():
|
|
files = [f for f in os.listdir(FMEA_DATA_DIR) if f.endswith(".tsv")]
|
|
for filename in files:
|
|
file_path = os.path.join(FMEA_DATA_DIR, filename)
|
|
with open(file_path, "r", encoding="utf-8", errors="replace") as f:
|
|
reader = csv.reader(f, delimiter='\t')
|
|
try:
|
|
headers = next(reader)
|
|
header_count = len(headers)
|
|
for i, row in enumerate(reader, start=2):
|
|
if len(row) != header_count:
|
|
print(f"{filename}: Row {i} has {len(row)} columns, expected {header_count}")
|
|
except StopIteration:
|
|
pass
|
|
|
|
if __name__ == "__main__":
|
|
check_tsv()
|