I want to create a file and write some integer data to it in python. For example, I have a variable abc = 3 and I am trying to write it to a file (which doesn't exist and I assume python will create it on its own):
fout = open("newfile.dat", "w") fout.write(abc)
First, will python create a newfile.dat on its own? Secondly, it's giving me this error:
IOError: [Errno 13] Permission denied: 'newfile.dat'
What's wrong here?
Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.
Please close the file if its still open on your computer, then try running the python code. I hope it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With