title: PYTHON2 - Is there ways to declare encoding method in csv write
body: <p>When I try to write cursor result coming from database execution (type is a list) to the csv, the error throws 
  <strong>a.writerow(lst) TypeError: write() argument 1 must be unicode, not str</strong></p>
  
  <p>This is for python2. I've tried in python3 like the script below. But the system requirement asks me to change Python2. </p>
  
  <p>This is the correct script using python3. </p>
  
  <pre><code>    results_percent = cursor.fetchall()
      with open(file4,'w',encoding="utf-8",newline='') as fp:
          a = csv.writer(fp, delimiter=',')
          a.writerow(['MFIName','ClientCountAtSignUp','UploadCountLastMonth','UploadCount','80%','Status'])
          a.writerows(results_percent)
  
  </code></pre>
  
  <p>The below is by using python2 which gives me error <strong>a.writerow(lst) TypeError: write() argument 1 must be unicode, not str</strong></p>
  
  <pre><code>   results_percent = cursor.fetchall()
     with io.open(file4,'w',encoding='utf-8') as fp:
         a = csv.writer(fp, delimiter=',')
         lst = ['MFIName','ClientCountAtSignUp','UploadCountLastMonth','UploadCount','80%','Status']
         a.writerow(lst)
         a.writerows(results_percent)
  </code></pre>
  
  <p>The output is to write results_percent to csv file.</p>