Reputation: 23
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.
Upvotes: 2
Views: 48
Reputation: 352
i run you code in a python3 interpreter under Mac OS, it worked.
maybe it's related to your system, space in the filename may be a problem.
Upvotes: 1