I've got a list in a Python program that contains a series of numbers, which are themselves ASCII values. How do I convert this into a "regular" string that I can echo to the screen?
+19
A:
You are probably looking for 'chr()':
>>> L = [104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100]
>>> ''.join(chr(i) for i in L)
'hello, world'
Thomas Wouters
2008-10-07 21:54:33
+3
A:
l = [83, 84, 65, 67, 75]
s = "".join([chr(c) for c in l])
print s
Thomas Vander Stichele
2008-10-07 21:55:06
+1
A:
import array
def f7(list):
return array.array('B', list).tostring()
Toni Ruža
2008-10-08 20:22:31