title: csv module python3.1
body: <p>Im using the following in Python2.x ; </p>
  
  <pre><code>import csv
  f = open('test.csv', 'wb')
  writer = csv.writer(f)
  writer.writerow((fpath, md5sum, size)) # &lt;str&gt;, &lt;str&gt;, &lt;int&gt;
  </code></pre>
  
  <p>This works without any problems. However, when I run this in Python3, I get a TypeError.</p>
  
  <pre><code>writer.writerow((fpath, md5sum, size))
  TypeError: write() argument 1 must be bytes or buffer, not str
  </code></pre>
  
  <p>Of course, writing out the data to a file in opened in non-binary mode would do the trick, but I like the way Unicode is handled in Py3 and wish to specifically encode data before writing to a file and decode it when reading from it.</p>
  
  <p>How do I solve this problem?</p>