converting an array of chars to a string
warlock at eskimo.com
Fri Jun 21 19:11:23 CEST 2002
-----BEGIN PGP SIGNED MESSAGE-----
On Fri, 21 Jun 2002 08:22:02 GMT,
Derek Thomson <derek at wedgetail.com> wrote:
> 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
cool, thanks, that solved a problem I was having.
<muttter> when did that show up? or was I not paying attention?</mutter>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
-----END PGP SIGNATURE-----
Anarchist, pagan and proud of it
Linux, from watches to supercomputers, for grandmas and geeks.
More information about the Python-list