Hi all,
I have data of the following form in a file called "fluid_grid.dat "
1.0000000000000 0 0.0000000000000 0D+000
0.9597539695086 36 0.2808421585382 36
0.8422553639751 69 0.5390787529248 91
0.6569618883215 83 0.7539237874566 23
0.4187881962898 89 0.9080839425120 68
0.1469053792235 83 0.9891505494893 97
The first column gives values of x and the second, the values of y
My aim is to read the data into x(i), y(i) where i=1,6, and I wrote the following code for the purpose.
ifile4=open('fl uid_grid.dat',' r')
lines=ifile4.re adlines( )
x=[ ]
y=[ ]
i=1
for line in lines:
x[i],y[i]=map(float,line .replace('D','E ').split( ))
i=i+1
if i==7:
break
I get the following error:
x[i],y[i]=map(float,line .replace('D','E ').split( ))
Index Error: list index out of range
Can someone help me ? Please let me know if there is a better way to serve my purpose.
Thanks
Regards,
Satish Kumar Chimakurthi
SATISH KUMAR CHIMAKURTHI
Graduate Research Assistant
CFD GROUP
Mechanical Engineering
UNIVERSITY OF KENTUCKY
Lexington
KENTUCKY - 40508
U.S.A
Email: skchim0@engr.uk y.edu
Mobile:859-420-9890
Office: 859-257-6336 X 80691
I have data of the following form in a file called "fluid_grid.dat "
1.0000000000000 0 0.0000000000000 0D+000
0.9597539695086 36 0.2808421585382 36
0.8422553639751 69 0.5390787529248 91
0.6569618883215 83 0.7539237874566 23
0.4187881962898 89 0.9080839425120 68
0.1469053792235 83 0.9891505494893 97
The first column gives values of x and the second, the values of y
My aim is to read the data into x(i), y(i) where i=1,6, and I wrote the following code for the purpose.
ifile4=open('fl uid_grid.dat',' r')
lines=ifile4.re adlines( )
x=[ ]
y=[ ]
i=1
for line in lines:
x[i],y[i]=map(float,line .replace('D','E ').split( ))
i=i+1
if i==7:
break
I get the following error:
x[i],y[i]=map(float,line .replace('D','E ').split( ))
Index Error: list index out of range
Can someone help me ? Please let me know if there is a better way to serve my purpose.
Thanks
Regards,
Satish Kumar Chimakurthi
SATISH KUMAR CHIMAKURTHI
Graduate Research Assistant
CFD GROUP
Mechanical Engineering
UNIVERSITY OF KENTUCKY
Lexington
KENTUCKY - 40508
U.S.A
Email: skchim0@engr.uk y.edu
Mobile:859-420-9890
Office: 859-257-6336 X 80691