2

I have the following binary strings

In [32]: print(codes)
['01000011', '01101111', '01101101', '01110000', '01110101', '01110100', '01100101', '01110010', '00100000', '01010011', '01100011', '01101001', '01100101', '01101110', '01100011', '01100101']

decode them as

In [33]: for c in codes:
    ...:     print(chr(int(c, 2)))
    ...:     
C
o
m
p
u
t
e
r

S
c
i
e
n
c
e

The text is printed with an implicit '/n',

How could print the output in one line?

Alice
  • 1,360
  • 2
  • 13
  • 28

1 Answers1

2
 codes = ['01000011', '01101111', '01101101', '01110000', '01110101', '01110100', '01100101', '01110010', '00100000', '01010011', '01100011', '01101001', '01100101', '01101110', '01100011', '01100101']

    print codes

    test = ''
    for c in codes:
         test += (chr(int(c,2)))

    print test
D.Morrissey
  • 114
  • 8