I have the following input file 'r1'
14 14
15 15
I would like to create the following output file 'r2'.
14 14 less than 15
15 15 equal to 15
I am trying to do so using the following code.
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'
However, when I run the program I get the following error if atim<15 and alat<15: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()