I want to join two csv files into one like this:
**file 1:**
feb,55,1.23,..,..,0
mar,65,2.33,..,..,1
**file 2:**
feb,55,..,12,KL,..
mar,65,..,10,MN,..
so the output would be something like this:
feb,55,1.23,12,KL,0
mar,65,2.33,10,MN,1
My following code snippet doesn't works:
f1=[li.split(',') for li in open("file1.csv","r+")]
f2=[lj.split('\t') for lj in open("file2.csv","r+")]
def joinL(x,y):
list=[]
for n in x:
for m in y:
if n[0]==m[0]:
list.append(m)
return list
print joinL(f1,f2)
Could you please help Thanks!