converting an array of chars to a string

Jim Richardson warlock at eskimo.com
Fri Jun 21 19:11:23 CEST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
> 
> 
> Regards,
> Derek.
> 

huh! 

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)

iD8DBQE9E147d90bcYOAWPYRAl91AJ44se3CAT5EoLfRoF9vUBVbdPuqVACg03Qs
HWQP8Sqoh+OMF1xSn2b28Ew=
=1+ZI
-----END PGP SIGNATURE-----

-- 
Jim Richardson
	Anarchist, pagan and proud of it
http://www.eskimo.com/~warlock
Linux, from watches to supercomputers, for grandmas and geeks. 



More information about the Python-list mailing list