numpy - Python save txt file in a different folder -


the following script running , saving txt output in desktop running script desktop. however, want save txt files documents in new folder named ascii. how can give command doing that. 8phases.txt has following lines-

-1  1   -1  -1  1   1  1   1   1  1   -1  1  -1  -1  -1  1   1   -1  1   -1  -1  -1  -1  1 

the script-

import numpy np import matplotlib.pyplot plt  d=12 n=np.arange(1,4) x = np.linspace(-d/2,d/2, 3000) = np.array([125,300,75]) phase = np.genfromtxt('8phases.txt')  i_phase = i*phase  count,i in enumerate(i_phase):     f = sum(m*np.cos(2*np.pi*l*x/d) m,l in zip(i,n))     s = np.column_stack([x,f])     np.savetxt((str(count)+'.txt'),s) 

any please-

you should provide full path in argument of savetxt method, example:

np.savetxt(r"c:\ascii\%s.txt" % count,s) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -