CMD windows running .py scrip not writing to txt file, but running in pycharm does write to the file

Viewed 39
print("What is this for?:")
z = input(str())
print("Username:")
x = input(str())
print("Password:")
y = input(str())

f = open("UserandPass.txt", 'a')
f.write('\n')
f.write('\n' + 'Domain:')
f.write('\n' + z)
f.write('\n' + 'Username:')
f.write('\n' + x)
f.write('\n' + 'Password:')
f.write('\n' + y)
f.close()

g = open("UserandPassbackup.txt", 'a')
g.write('\n')
g.write('\n' + 'Domain:')
g.write('\n' + z)
g.write('\n' + 'Username:')
g.write('\n' + x)
g.write('\n' + 'Password:')
g.write('\n' + y)
g.close()

print(z)
print(x)
print(y)

So I'm running a program in pycharm that can write text to a .txt file fine. The issue comes along when I run the .py script in the cmd prompt... doesn't write to the file. There are no errors, in the cmd prompt after running either. Not sure what is going on.

1 Answers
Related