My code writes my data in a file and I have just introduced the zip function, so now my whole code is correct order But this is all on the same line and is not working to put the '\ n' part after each on a new line. How do I write the data file, so that each list can be written in a new line?
Noop = NP Colors (1,2) For the kill in the tube: If kg and lt; 10: kg = '0' + ARR (kg) Other: kg = RR (kg) data file2 = open (str (kill) + 'tampa.T.TT', 'w') e1 = np.jinframetext (str (kill) ) + '_temp.txt'). T [0] Mean 1 = N.P.men (E1) E2 = N.P. Genframtext (SRR (kg) + '_ TMTPTTT'). T [1] mee 2 = np.men (E2) E1 = E1-meane1 E2 = e1-meane2 phi = np.arctan2 (E2, E1) a = [E1, E2, PHI] A = zip (* A ) Data file 2. Written (str (a) + '\ n') Data file 2 .col ()
Zip returns a list. On a single list, it will put all on the same line that something like: datafile 2.whitlines (str (x) + '\ n' X) will do what you want. Alternatively, you can write more results in the str.join list: datafile2.write ('\ n'.join (map (str, a) ))
No comments:
Post a Comment