csvfile_ = open(finishedFileName+num+\".csv\",\"w\",newline=\'\') writ = csv.writer(csvfile_, dialect=\'excel\') firstline = unicode(str(firstline)) try: writ.writer
I had the same problem with open() and csv. A friend gave me the solution, which is to use open_output() instead of open(). open_output() defaults to "wb" instead of text.