write two values to csv row in python
Question: So I have a solved problem, but I don't like the solution :)

    
    
    with open(outfile, 'a') as file:
        writer = csv.writer(file) #opens a csv writer
        #inserts ID to front of wordList
        wordList.insert(0,ID)
        writer.writerow(wordList)
        #removes ID
        wordList.remove(ID)
    

Right now it successfully writes an ID and a list of words into csv form (as
far as I can tell-- I don't actually have excel on my computer). The part I
don't like is that I have to insert and remove the ID, because I don't want it
included later. This seems lame. Can I somehow do a double insert to the same
row, easily?

I tried:

    
    
     writer.writerow([ID,wordList])
    

but it gave undesirable square brackets

This is for 2.7, if that matters! Thanks !


Answer: 
    writer.writerow([ID] + wordList)
    

or

    
    
    from itertools import chain
    
    writer.writerow(chain([ID], wordList))
    

