[SciPy-user] Convert a string list to array ?
Tue Feb 26 13:50:53 CST 2008
I have a string list that I want to convert to an integer array
data_all = [ '12', '24' ]
and now I would expect this would work, but it crashes:
data_all = asarray ( data_all, dtype = int )
so I need to do the conversion in 2 steps
data_all = asarray ( asarray ( data_all ), dtype = int )
Is there a better (more elegant) way ?
And maybe the string list was even the wrong first step,
the datafile I'm reading looks like this:
254 48 57
58 52 53
58 51 54
254 32 32
32 32 32
So there might even be better ways to start ?
More information about the SciPy-user