79675645

Date: 2025-06-23 05:16:23
Score: 1
Natty:
Report link

You're getting the error because \ in strings can create escape sequences. Fix it by using a raw string or double backslashes:

file = open(f"files\\{filename}", "w")

or

file = open(rf"files\{filename}", "w")

Also, ensure the files folder actually exists before running the code.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Nas_T