[Numpy-discussion] Transforming an array of numbers to an array of formatted strings

David Huard david.huard@gmail....
Thu Mar 13 14:07:33 CDT 2008


['S%03d'%i for i in int_data]

David


2008/3/13, Alan G Isaac <aisaac@american.edu>:
>
> On Thu, 13 Mar 2008, Alexander Michael apparently wrote:
> > I want to format an array of numbers as strings.
>
>
> To what end?
> Note that tofile has a format option.
> And for 1d array ``x`` you can always do::
>
>     strdata = list( fmt%xi for xi in x)
>
> Nice because the counter name does not "bleed" into your program.
>
> Cheers,
> Alan Isaac
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080313/ca627ad1/attachment.html 


More information about the Numpy-discussion mailing list