On Tue, Mar 28, 2006 at 07:32:15PM +0200, Luis Simoes wrote: > Hi everybody, > > do somebody know how to convert a list or an array to a string when changed > the size of the items? > I use the packet_utils.py where i changed the functions whiten(s). First I > slice the string s into UnsignedInt8 items into a list sa (as done in the > original source code). Then I map a function to this list and it results in > 16 bit items of the new list z. When I try to use z.tostring() method it > doesn't work. The str(z) function also gives wrong results. How can I join > this 16bit items to one string? the number of elements in z is variable. And > the resulting string should be slices in a new function into UnsignedInt8 or > Int16 intems. > > I could not find anything in the python docs and tutorials that resolves my > problem. > > Thanks for any advice, > > Luis
Hi Luis, .tostring is from Numeric and only works on 8-bit arrays. As written, whiten just xors with a fixed pattern. You could get to strings using the python struct.pack method, or converting your sequence of N 16-bit items to 2*N 8-bit items, then working with those. It all depends on what you're trying to do. Eric _______________________________________________ Discuss-gnuradio mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
