Problem bytes to str
I'm new in jython and I try to convert bytes to str.
do yo开发者_运维问答u know how I can do this? Thanks
from array import array
a = array('b', [30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])
print ', '.join(map(str, a))
try:
from array import array
a = array('b', [30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])
print a.tostring()
print a.tounicode()
You can use String.join()
with array as a sequence:
import array
ar = array.array('b', [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47])
ars = ', '.join(str(x) for x in ar)
print(ars)
精彩评论