From: Magnus L. H. <ma...@he...> - 2002-04-25 14:53:13
|
Magnus Lie Hetland <ma...@he...>: [snip] Just a quick explanation for why I'm interested in this... I've got a two-dimensional array of ints (or bytes, actually), that I would like to convert to a delimited string (e.g. comma-separated). This works in Numeric: >>> from string import letters >>> alphabet = array(letters) >>> data = arange(24) # E.g... >>> data.shape = 6, 4 >>> fields = sum(take(alphabet, data), 1) >>> ','.join(fields) 'abcd,efgh,ijkl,mnop,qrst,uvwx' -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.org |