0

When I run the following code I get an error named permission denied:

f=open('C:/Windows/System32/azm.txt','w')
f.write('+989193667998')
f.close()
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

On Windows, use backslashes instead of slashes to specify file paths:

f = open(r'c:\windows\system32\azm.txt', 'w')

And since you're trying to write to a system directory, make sure you run your code as Administrator.

Pantalaimon
  • 49
  • 1
  • 7