[issue4588] Need a way to make my own bytes

2008-12-07 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: Please don't use the bug tracker to obtain help, but only to report bugs. Use [EMAIL PROTECTED] to get help. In this specific case, also read Benjamin's answer more carefully. -- nosy: +loewis __

[issue4588] Need a way to make my own bytes

2008-12-07 Thread jeff deifik
jeff deifik <[EMAIL PROTECTED]> added the comment: Doesn't work. #!/usr/bin/env python3.0 import sys foo = b'' for i in range (0,10): foo += bytes(i) sys.stdout.buffer.write(foo) produces a binary file of 45 bytes. Here is a hex dump (the '.' represent unprintable characters): +00000

[issue4588] Need a way to make my own bytes

2008-12-07 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: bytes([some_number]) should do the trick. -- nosy: +benjamin.peterson resolution: -> invalid status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___

[issue4588] Need a way to make my own bytes

2008-12-07 Thread jeff deifik
New submission from jeff deifik <[EMAIL PROTECTED]>: I want to make my own data of types bytes in order to write it out. For example, I want to write out the bytes 0..9 #!/usr/bin/env python3.0 foo = b'' for i in range (0,10): foo += i #sys.stdout.buffer.write(foo) Here is the error: Traceb