title: TypeError: must be string or read-only character buffer, not list
body: <p>I am trying to connect to a DB and get a data.</p>
  
  <p>But when I am trying to write into a file it gives me the below error.</p>
  
  <pre><code>TypeError: must be string or read-only character buffer, not list
  </code></pre>
  
  <p>Below is my sample code.</p>
  
  <pre><code>import pyodbc
  path= "M:/xyz/"
  file_write=open( path +"files.test.log", "w")
  #print "Connection started"
  db=pyodbc.connect('DSN=DB_NAME;PWD=xyz')
  #print "Connection done"
  cursor = db.cursor()
  book_value="WPZ.N"
  query="SELECT book_id FROM Table_name WHERE book_value='"+book_value+"'"
  #print query
  cursor.execute(query)
  book_id= cursor.fetchall()
  file_write.write(book_id)
  #str(file_write)
  #print file_write
  </code></pre>
  
  <p>Please Guide on This.</p>
  
  <p>Thanks.</p>