Wildman <best_...@yahoo.com> writes:
>     names = array.array("B", '\0' * bytes)
> TypeError: cannot use a str to initialize an array with typecode 'B'

In Python 2, str is a byte string and you can do that.  In Python 3,
str is a unicode string, and if you want a byte string you have to
specify that explicitly, like b'foo' instead of 'foo'.  I.e.

     names = array.array("B", b'\0' * bytes)

should work.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to