[PYTHON STRING-SIG] Re: [PYTHON MATRIX-SIG] Array -> Str
Robin.K.Friedrich@usahq.unitedspacealliance.com
Robin.K.Friedrich@usahq.unitedspacealliance.com
Fri, 9 May 1997 07:52:42 -0500
Well maybe your talking about the numeric's array and not python's
original array module but what's wrong with using the array object
method designed for that?
charray.tostring()
_________________ Reply Separator __________________
Subject: [PYTHON STRING-SIG] Re: [PYTHON MATRIX-SIG] Array -> String
Author: Jim Fulton <jim.fulton@digicool.com> at INTERNET
Date: 5/7/97 10:03 AM
Konrad Hinsen wrote:
>
> Has anyone found an efficient method to convert a character array into
> a string? The only solution I could come up with is
>
> string = reduce(operator.add, array)
>
> which is of course terribly inefficient.
How about
string=string.join(list(array),'')
Of course, ot would be nicer of string.join accepted any type of
sequence.
Jim
--
Jim Fulton Digital Creations
jim@digicool.com 540.371.6909
## Python is my favorite language ##
## http://www.python.org/ ##
_______________
STRING-SIG - SIG for Enhanced String Processing in Python
send messages to: string-sig@python.org
administrivia to: string-sig-request@python.org
_______________
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________