I am facing the same problem that little complicated.
I have this kind of data in a file and actually it's coming from another class 
and it's in formex:0 00 11 01 1and another data which it's in form :0110so now 
what I need to put it in form data= [[[0,0],[0]],          [[0,1],[1]],     
[[1,0],[1]],    [[1,1],[0]]    ]
that is the form for a class that I can use the [0,1] is the inputs and 
inputs[0] is = 0 and inputs[1] is = to 1 . the same thing to the output[0] is = 
0 and so onok, now this is the problem I have successes to to that reading from 
file in form0 00 11 01 1the output0110and I write it in a file called it data 
in the new form which is exactly what I want in form       [[[0,0],[0]],        
  [[0,1],[1]],      [[1,0],[1]],    [[1,1],[0]],]but I got a problem. I cannot 
use this as a data when I read it from the data file cuz it's string and I 
tried to use int but couldn`t solve it yet.wish you can help me to find the 
solution in this problemether I can read the data from the original file and 
deal with it separately or write it to file and read it again which I am trying 
to do
f=open('data.txt')t=open('target.txt')n=file('newdata.txt','w')
def arange (inputs, targets, outputfile):  casesNo = len (inputs.readline())    
for s in range (casesNo):    for line in inputs:        data=line.rsplit()      
  i=','.join(data)        break    for line1 in targets:        
data1=line1.rsplit()        #print data1[0]        u=','.join(data1)        z= 
str(i)        w= str(u)        outputfile.write('[[%s],' % (z)+ '[%s]], \n' 
%(w))        break        outputfile.close()    arange(f,t,n) # f : input data, 
t: target data, n: outputfilelooking to hearing from you as soon as,once again 
thanks for your help and cooperation,
Regards, 

                                          
Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now.  
                                  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to