[New-bugs-announce] [issue4588] Need a way to make my own bytes
report at bugs.python.org
Mon Dec 8 04:29:30 CET 2008
New submission from jeff deifik <jeff at jeffunit.com>:
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
foo = b''
for i in range (0,10):
foo += i
Here is the error:
Traceback (most recent call last):
File "./x.py", line 4, in <module>
foo += i
TypeError: can't concat bytes to int
I cannot find any function to convert the int i into something
that I can append to foo. I tried chr, which produced a string
typeerror. byte() was not defined. There must be a way to convert
an integral value to a bytes type.
components: Interpreter Core
title: Need a way to make my own bytes
versions: Python 3.0
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce