# -*- coding: UTF-8 -*- """ @Project :Matrix_Check @File :SignalInitTableCheck.py @Author :haojiang @Date :2022/9/28 18:15 """ import csv from enum import Enum class TableColumnHeaderType(Enum): Signal = 0 Type = 1 Bit = 2 App = 3 AppValue = 4 Raw = 5 RawValue = 6 Controller = 7 Frame = 8 PDU = 9 class SignalInitTableCheck: Column_Need_Check = [TableColumnHeaderType.Signal.value, TableColumnHeaderType.Type.value, TableColumnHeaderType.Bit.value, TableColumnHeaderType.RawValue.value] def __init__(self): pass def get_csv_data(self, file_name: str): with open(file_name, 'r') as csvfile: spamreader = csv.reader(csvfile, delimiter=',') is_header_readed = False table_data = list() for row in spamreader: if not is_header_readed: is_header_readed = True continue table_data.append([row[column] for column in SignalInitTableCheck.Column_Need_Check]) return table_data if __name__ == '__main__': matrix_path = r'D:\01_Work\02_WP\EP39_EREV\branch\src\MatrixAssistant_V2.0\EP39_EREV_SIMU+_GW\20220729-qy1-EP39EREV_SIMU+_GW_Rx_初值表.csv' sc = SignalInitTableCheck() sc.get_csv_data(matrix_path)