H T
H T

Reputation: 40

python 2.7: run from cmd vs directly from python

I wrote the next program:

with open('h.txt','a') as f:
    f.write('asd')

when i run it from the cmd (e.g typed C:\Users\USER\PycharmProjects\2016_project\test.py in the cmd) - no new file was created

but when I double clicked the icon in the windows explorer (I'm with windows (10)) a new text file was created

can someone explain to me what's happening?? and how to bypass this problem?

(p.s. I'm most of the time in school so it may take me a little time to responce) thanks

Upvotes: 0

Views: 50

Answers (1)

JRazor
JRazor

Reputation: 2817

Choose the folder and use Python to run. Use like:

cd C:\Users\USER\PycharmProjects\2016_project
python test.py

Upvotes: 1

Related Questions