【发布时间】:2014-04-09 21:38:07
【问题描述】:
我有以下输入文件'r1'
14 14
15 15
我想创建以下输出文件 'r2'。
14 14 less than 15
15 15 equal to 15
我正在尝试使用以下代码。
import numpy as np
s=open('r1')
r=open('r2','w+')
r1=np.loadtxt(s)
atim=r1[:,[0]]
alat=r1[:,[1]]
if atim<15 and alat<15:
print >> r,atim,alat,'less than 15'
if atim==15 and alat==15:
print >> r,atim,alat,'equal to 15'
但是,当我运行程序时,我收到以下错误 如果 atim
【问题讨论】:
-
这是一个非常好的错误消息,您是否尝试按照您收到的建议进行跟进?