检查csv文件内容长度
程序员文章站
2024-02-26 10:39:58
...
# coding=utf-8
import os
csv_path = os.path.join(os.getcwd(),r'vivo正式\csv')
csv_file = os.listdir(csv_path)
name_list = []
for csv in csv_file:
name_csv = os.path.splitext(csv)[0].split('_')[0]
t2 = open(os.path.join(csv_path,csv),'r')
r2 = t2.readlines()
if len(r2)!=4:
name_list.append(name_csv)
print('以下机型数据有缺失')
print(name_list)