备忘:fortran、python读取文件的差别
Example: Read ascii data from file...964.0000 305.29 15.713
0.0000 305.29 15.713 -3.0730 8.4429
127.17 304.52 15.137 -4.4020 12.094
359.00 304.42 14.117 -5.1683 19.288
593.61 304.35 13.016 -1.8411 19.884
833.33 304.34 12.268 2.2744 19.839
1080.0 304.55 10.787 5.1683 19.288
1331.5 305.26 8.8552 6.9083 18.110
PMinteger, parameter :: nmax = 10000!
integer n, ios
real p0, t0, q0
real, dimension(nmax) :: q, t, q, u, v
open(10,file='data.ascii',form='formatted')
read(10,*) p0, t0, q0
do n = 1,nmax
!read(10,*,iostat=ios) z(n), t(n), q(n), u(n), v(n)
!if( ios == -1 ) exit
enddo
close(10)
f = open("data.ascii", "r")
p0, t0, q0 = f.readline()
d = f.read().split()
z, t, q, u, v = d,d,d,d,d
f.close()
页:
[1]