SyntaxFix
Write A Post
Hire A Developer
Questions
If you're using Python 2.x on Windows you need to change your line open('test.csv', 'w') to open('test.csv', 'wb'). That is you should open the file as a binary file.
open('test.csv', 'w')
open('test.csv', 'wb')
However, as stated by others, the file interface has changed in Python 3.x.