import csvclass CSVUtil:def __init__(self,file_path):self.file_path=file_path#初始化file_path的值# 读取csv文件里的数据,存储在列表类型的变量里返回。def get_list_data(self):value_rows=[]with open(self.file_path,'r',encoding="utf-8") as f:f_csv=csv.reader(f)next(f_csv)for r in f_csv:value_rows.append(r)return value_rows# 为了调试当前读取csv文件的工具类而书写的一段调试代码,不是必须要写的。if __name__ == '__main__':u=CSVUtil("..\\testdata\\test4.csv")d=u.get_list_data()print(d)
