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:
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
messages: 77286
nosy: lopgok
severity: normal
status: open
title: Need a way to make my own bytes
type: crash
versions: Python 3.0

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4588>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to