for i in range(booksheet._dimnrows): text = booksheet.row_values(i) if text[1] not in s_list: s_list.append(text[1])
count_list = [0 for i in range(s_list.__len__())] for i in range(booksheet._dimnrows): text = booksheet.row_values(i) s_index = s_list.index(text[1]) count_list[s_index]+=1
with open('data/'+ str(j) +'.csv',encoding='utf-8',mode='w') as f: for index,i in enumerate(s_list): add_list = ['0'+str(j)+'/04/2018',i,str(count_list[index])] line = ",".join(add_list)+'\n' f.write(line) print('完成第{}个文件!'.format(j))
for i in range(booksheet._dimnrows): text = booksheet.row_values(i) text = [str(i) for i in text] ship = text[1] with open('ship/'+ship+'.csv',encoding='utf-8',mode='a') as f: f.write(",".join(text)+'\n')