Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write bytes to a binary stream, instead of a string one #2

Merged
merged 1 commit into from Nov 15, 2011

Conversation

phihag
Copy link
Contributor

@phihag phihag commented Nov 15, 2011

open('file', 'w').write('bytes')

is wrong, the file should be opened with 'wb'. Most notably, the equivalent Python 3 will crash

# Python 3
open('file', 'w').write(b'bytes')

kumar303 added a commit that referenced this pull request Nov 15, 2011
Write bytes to a binary stream, instead of a string one
@kumar303 kumar303 merged commit 2d2c0fd into kumar303:master Nov 15, 2011
@kumar303
Copy link
Owner

Thanks, I pulled in the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants