vendredi 24 janvier 2020

Defining if statement for reading text file to constraint the reading values

I am doing the following case, but I never did this before and now I am facing many problems, I need your help. Sorry if my question is amateurish.

I want to read two text files (3 columns and 1000 rows) and divide the values of column I inside both files by together I1/I. But If we have specific values of n, t, n1, t1.

n, t, I = np.genfromtxt('C:/...nu/I1.txt',unpack=True)
n1, t1, I1 = np.genfromtxt('C:...nu/I2.txt',unpack=True)
with open('C:/Users/esadr21/Desktop/uf/newInu/Inu101rat.txt', 'w') as d:
    if 1e2<n<3e5 and 1e1<t<3e1 and 1e-2<n1<1e-5 and 1e1<t1<2e6:
            rat = I1/I
            d.write("{0}\n".format(rat))
    else: pass

but this way doe not work. Any help please?

Aucun commentaire:

Enregistrer un commentaire