Can anyone explain how to work with paths with python on windows.
the path is given as parameter
path = 'C:\Data\Projects\IHateWindows\DEV_Main\Product\ACSF\Dev\DEV\force.com\src\aura'
Im trying to get the content of the folder but is not a valid path is reading the path as:
'C:\\Data\\Projects\\IHateWindows\\DEV_Main\\Product\\ACSF\\Dev\\DEV\x0corce.com\\src\x07ura'
trying some solutions...
for f in listdir(path.replace("\\", "\\\\")): print (f)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\\\Data\\\\Projects\\\\Prd_Development\\\\DEV_Main\\\\Product\\\\ACSF\\\\Dev\\\\DEV\x0corce.com\\\\src\x07ura'
for f in listdir(path.replace("\\", "/")): print (f)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:/Data/Projects/Prd_Development/DEV_Main/Product/ACSF/Dev/DEV\x0corce.com/src\x07ura'
EDIT: Solution
path = path.replace("\a", "\\a").replace("\f", "\\f")