Message77286
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:
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. |
|
Date |
User |
Action |
Args |
2008-12-08 03:29:30 | lopgok | set | recipients:
+ lopgok |
2008-12-08 03:29:30 | lopgok | set | messageid: <1228706970.47.0.163581858877.issue4588@psf.upfronthosting.co.za> |
2008-12-08 03:29:29 | lopgok | link | issue4588 messages |
2008-12-08 03:29:29 | lopgok | create | |
|