Out of memory while reading excel file
codewizard at gmail.com
codewizard at gmail.com
Fri May 12 18:48:24 EDT 2017
On Thursday, May 11, 2017 at 5:01:57 AM UTC-4, Mahmood Naderan wrote:
> Excuse me, I changed
>
> csv.writer(outstream)
>
> to
>
> csv.writer(outstream, delimiter =' ')
>
>
> It puts space between cells and omits "" around some content. However, between two lines there is a new empty line. In other word, the first line is the first row of excel file. The second line is empty ("\n") and the third line is the second row of the excel file.
>
> Any thought?
>
> Regards,
> Mahmood
Try opening the destination file in the binary mode:
open(dest, 'wb')
I ran into extra newlines when using csv.writerows() recently.
Since the default mode for open() is text, I imagine you get
extra newlines, since both csv and file object are adding them.
Switching to binary mode fixed it for me.
Regards,
Igor.
More information about the Python-list
mailing list