converting an array of chars to a string
Derek Thomson
derek at wedgetail.com
Fri Jun 21 04:22:02 EDT 2002
JB wrote:
> How can I convert an array of chars to string?
>
> The problem is this: I should like to perform 8 bit
> calculations in a buffer. After this has been done, the
> buffer has to ba written to a binary file (and file.write
> takes strings instead of lists).
>
Easy, just use the "join" function to concatenate a sequence of strings
into a single string. For example:
import string
list = ['a', 'b', 'c', 'd']
s = string.join(list, '')
print s
Regards,
Derek.
More information about the Python-list
mailing list