- Jun 15, 2001
- 34,545
- 1,707
- 126
I'm ready to break something.
I need to read in a bunch of numbers from a file. They are in the format
[x1,y1,z1]
[x2,y2,z2]
I just need it to strip out the variables and store them in an array. So when I say 'print z[16]', it prints the 16th z value. I haven't messed with python in years, and it's driving me up the freaking wall to say the least.
The tutorial included with Python isn't helping me, and neither is the reference guide. How can I read in an arbitrary number of numbers, with commas separating them, into an array. All of the x values go into the x array, the y values into the y array, etc.
Thanks for your help.
I need to read in a bunch of numbers from a file. They are in the format
[x1,y1,z1]
[x2,y2,z2]
I just need it to strip out the variables and store them in an array. So when I say 'print z[16]', it prints the 16th z value. I haven't messed with python in years, and it's driving me up the freaking wall to say the least.
The tutorial included with Python isn't helping me, and neither is the reference guide. How can I read in an arbitrary number of numbers, with commas separating them, into an array. All of the x values go into the x array, the y values into the y array, etc.
Thanks for your help.