Hello, I am having so many issues with \
In a directory with a path like:
"F:\somefolder\ 2007\somefolder \2007\somefolde r\*.txt files"
I have been trying to make a path out of this to access the files with glob but \2007 keeps messing things up. It turns into \x807 when saved as string.
Some of the solutions I can use to work around this are:
1) I can work around it is by using os.path.join() and hardcoding all the folders names. However, I want to be able to just specify the directory at run time.
2) I can use / instead of \ and then use split with /. This is reasonable but again it does not really work for me because I want to be able to just copy the directory path from the windows and paste it; not deal with changing all the slashes.
Can someone please suggest something clever.
In a directory with a path like:
"F:\somefolder\ 2007\somefolder \2007\somefolde r\*.txt files"
I have been trying to make a path out of this to access the files with glob but \2007 keeps messing things up. It turns into \x807 when saved as string.
Some of the solutions I can use to work around this are:
1) I can work around it is by using os.path.join() and hardcoding all the folders names. However, I want to be able to just specify the directory at run time.
2) I can use / instead of \ and then use split with /. This is reasonable but again it does not really work for me because I want to be able to just copy the directory path from the windows and paste it; not deal with changing all the slashes.
Can someone please suggest something clever.
Comment