I am trying to write to a file inside folder.But it is failing with below error.Please help.
Traceback (most recent call last):
File "C:/Users/admin/Desktop/scripts/de.py", line 6, in <module>
with open(mypath,"w+ ") as x:
IOError: [Errno 13] Permission denied: 'C:/Users/admin/Desktop/scripts25/hj214/f.txt'
Here is my code:
import os
mypath ="C:/Users/admin/Desktop/scripts25/hj214/f.txt"
if not os.path.exists( mypath):
os.makedirs(myp ath,0755);
print"Path is created"
with open(mypath,"w" ) as x:
x.write("This is a boy")
Traceback (most recent call last):
File "C:/Users/admin/Desktop/scripts/de.py", line 6, in <module>
with open(mypath,"w+ ") as x:
IOError: [Errno 13] Permission denied: 'C:/Users/admin/Desktop/scripts25/hj214/f.txt'
Here is my code:
import os
mypath ="C:/Users/admin/Desktop/scripts25/hj214/f.txt"
if not os.path.exists( mypath):
os.makedirs(myp ath,0755);
print"Path is created"
with open(mypath,"w" ) as x:
x.write("This is a boy")
Comment