I have a list like:
I should write every name and password like below format on output csv file:
I have used below code, but I dont know where I should update my list to make a correct output.
the output of my code is like below :
the code which I have used:
Quote:['danial', '5104', 'elham', '9770']
I should write every name and password like below format on output csv file:
Quote:daniel,5104
elham,9770
I have used below code, but I dont know where I should update my list to make a correct output.
the output of my code is like below :
Quote:d,a,n,i,a,l,",",5,1,0,4
e,l,h,a,m,",",9,7,7,0
the code which I have used:
esm=data[::2] #print(esm) pas=data[1::2] #print(pas) #for i in range(0,len(esm)): #dataf=[] #print('{},{}'.format(esm[i], pas[i])) #dataf.append(('{},{}'.format(esm[i], pas[i]))) with open('code.csv', 'w', newline='') as output_file_name: writer = csv.writer(output_file_name) for i in range(0,len(esm)): dataf=[] #print('{},{}'.format(esm[i], pas[i])) dataf.append(('{},{}'.format(esm[i], pas[i]))) writer.writerows(dataf) output_file_name.close()