Python3 CSV writerows, TypeError: 'str' does not support the buffer interface
<p>I am translating the following Kaggle code into Python3.4:</p>

<p>In the final lines when outputting a CSV file, </p>

<pre><code>predictions_file = open("myfirstforest.csv", "wb")
open_file_object = csv.writer(predictions_file)
open_file_object.writerow(["PassengerId","Survived"])
open_file_object.writerows(zip(ids, output))
predictions_file.close()
print('Done.')
</code></pre>

<p>there's a Type Error</p>

<pre><code>TypeError: 'str' does not support the buffer interface
</code></pre>

<p>which occurs at the line <code>open_file_object.writerow(["PassengerId","Survived"])</code>.</p>

<p>I believe this is because Opening a file in binary mode to write csv data to doesn't work in Python 3. However, adding <code>encoding='utf8'</code> in the <code>open()</code> line doesn't work either. </p>

<p>What is the standard way to do this in Python3.4? </p>