Solved
Windows paths break my print — \n in the middle of the path
OP
print("C:\new_folder\test.txt") prints a weird line break and a tab. What's going on?
Comments 4
Log in to join the discussion.
Log in Create account\nand\tinside a normal string are escape sequences (new line, tab). Your path happens to contain them.Options:
Raw string it is. Never knew forward slashes work on Windows!
For real projects look at
pathlib, it handles separators for you.This is the classic Windows trap. Took me a whole evening the first time.