Search code examples
pythonnotepad++

Running Python code from Notepad++ doesn't generate .txt files


So currently I'm practicing Python and I have this line of code:

print(f"{someList}", file=open("generatedList.txt", "w"))

When I tried to run it on Notepad++ using a run command of python "$(FULL_CURRENT_PATH)", it doesn't generates the .txt file but in the Notepad++ folder. When I tried to run exactly the same code to the IDLE it generates the .txt file on the working folder.

Why is that? Should I change something to the run command? I prefer Notepad++ as a text editor.

Btw, I'm using Python 3.8.5


Solution

  • So I don't know if it is okay but I think I know now how to make it save on wherever directory you want I just experimented and tried it out.

    from this code :

    print(f"{flippedCoins}", file=open("generatedFlips.txt", "w"))
    

    You'll just need to add the directory where would like to save it!

    print(f"{flippedCoins}", file=open("C:\The\Directory\You\Want\to\Save\it\generatedFlips.txt", "w"))