I'm trying to write to `file2.csv` file by values from `file1.csv` file using a keyfile.csv which contains the mapping between two files as the two files don't have the same column order. 

```
def convert():

    Keyfile = open('keyfile.csv', 'rb')
    file1 = open('file1.csv', 'rb')
    file2 = open('file2.csv', 'w')

    reader_Keyfile = csv.reader(Keyfile, delimiter=",")
    reader_file1 = csv.reader(file1, delimiter=",")
    writer_file2 = csv.writer(file2, delimiter=",")
    for row_file1 in reader_file1:
        for row_Keyfile in reader_Keyfile:
            for index_val in row_Keyfile:
                file2.write(row_file1[int(index_val)-1]+',')
    # Closing all the files     
    file2.close()
    Keyfile.close()
    file1.close()

# keyfile structure: 3,77,65,78,1,10,8...
# so 1st column of file2 is 3rd column of file1 ; 
# col2 of file 2 is col77 of file1 and so on

```

I'm only able to write only one row in `file2.csv`. It should have as many rows as there are in `file1.csv`. How do I move to the next row after one row is finished ? I'm assuming Loop should take care of that but that's not happening.What am I doing wrong ?