[Tutor] write dictionary to file
Ian D
duxbuz at hotmail.com
Fri Jun 20 16:01:32 CEST 2014
Ok making some progress by changing the 'wb' to 'w'
>
> Ok I see this error and the example shows a different type of syntax.
>
>
> Rather than a file open for writing:
>
> outfile = open('output.csv', 'wb')
>
>
> it uses
>
> with open('data.csv', 'w', newline='') as out:
>
>
>
> now is this written differently in order to implement this text mode thing or is it just the omission of the 'b' on the 'wb' that causes text mode?
>
>
>
> and if so could it be written:
>
> outfile = open('output.csv', 'w')
>
>
>
More information about the Tutor
mailing list