Python, among other languages, designates certain special characters as symbols beginning with a Windows-style backslash. Two common examples are \t ([TAB]) and \n (new line). Thus, in Windows, the notation
C:\folder\test.txt
is interpreted by Python as
C:[TAB]folder[TAB]text.txt or
C: folder test.txt
To work around this issue, you should use a double backslash (\\) to signify folders. The above example would then become:
C:\\folder\\test.txt
which would be properly interpreted to mean a specific file path.
Alternatively, you can use Macintosh format, which uses colons to signify folders as follows:
:folder:test.txt
© 2020-2023 Bondware, Inc. Last updated November 07, 2024