Python save txt file in a different folder
Question: the following script is running well and saving the txt output in the Desktop
as I am running the script from Desktop. However, I want to save the txt files
to my Documents in a new folder named ASCII. How can I give the command for
doing that. The 8phases.txt has the 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 as np
    import matplotlib.pyplot as plt
    
    D=12
    n=np.arange(1,4)
    x = np.linspace(-D/2,D/2, 3000)
    I = np.array([125,300,75])
    phase = np.genfromtxt('8phases.txt')
    
    I_phase = I*phase
    
    for count,i in enumerate(I_phase):
        F = sum(m*np.cos(2*np.pi*l*x/D) for m,l in zip(i,n))
        s = np.column_stack([x,F])
        np.savetxt((str(count)+'.txt'),s)
    

Any help please-


Answer: You should probably provide full path in argument of savetxt method, for
example:

    
    
    np.savetxt(r"C:\ASCII\%s.txt" % count,s)
    

