I have a list of directories hard coded into my program as such:
import os
my_dirs = ["C:\a\foo"
,"C:\b\foo"
,"C:\c\foo"
,"C:\t\foo"
]
I later want to perform some operation like os.path.isfile(my_dirs[3]). But the string my_dirs[3] is becoming messed up because "\t" is short for tab or something.
I know that a solution to this would be to use this:
my_dirs = ["C:\\a\\foo"
,"C:\\b\\foo"
,"C:\\c\\foo"
,"C:\\t\\foo"
]
And another solution would be to use forward slashes.
But I like being able to copy directories straight from explorer to my Python code. Is there any way I can tell Python not to turn "\t" into a tab or some other solution to my problem?