title: writing a list with multiple data to a csv file in separate columns in python
body: <pre><code>import csv
  from itertools import izip
      if l &gt; 0:
              for i in range(0,l):
          combined.append(str(questionList[i]).encode('utf-8') + str(viewList[i]).encode('utf-8'))
  #       viewcsv.append(str(viewList[i]).encode('utf-8'))
  #       quescsv.append(str(questionList[i]).encode('utf-8'))
          with open('collect.csv', 'a') as csvfile:
               spamwriter = csv.writer(csvfile, delimiter='\n')
               spamwriter.writerow(combined)
  #            spamwriter.writerows(izip(quescsv, viewcsv))
          return 1
      else:
          return 0
  </code></pre>
  
  <p>I need to generate a csv file and flood it with data from 2 or more lists into separate columns and not a single column. Currently I'm trying to combine two lists in one list(combined) and use this as input for writing, but I haven't got desired o/p.
  I have tried many things including the fieldnames way,izip way, but in vain.
  Eg:
      questionList     viewList
          4               3 views
          5               0 views</p>
  
  <p>The numbers used are just for example.</p>