bsnipes wrote:
> 
> 
> Jeff Johnson-8 wrote:
>> f = open('text.txt', 'w')
>>
> 
> You might want to change the 'w' to 'wb'.  My understanding is that Python
> will add a line ending automatically to the output that it writes to the
> file if not using 'write binary' and that might throw off what you expect to
> be there.
> 
> Brian

python doesn't add a line ending on it's own with f.write()!
If you use
print "something"
python adds a line ending but not with write.
And there is no need to open the file in binary mode because
line endings differ on win and unix platforms and you want to
get the right thing on both platforms.
In binary mode, you have to write a "\r\n" on windows instead of just
"\n".

Uwe



_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to