I am new at python and learning the language. The following code should create a file in the running program directory and write to it but it doesn't do this at all in a .py file. If I put the same code in the IDLE shell it returns 17. No errors just doesn't create the file. What am I doing wrong?
with open("st.txt", "w") as f: f.write("Hi from Python!") Thanks for the help Mike
"st.txt"import os; print(os.getcwd())w+, so the filw would also created if it does not existwith open("st.txt", "w+") as f:'w'is good enough to create the file.