Hi
Typically in a Windows path, I want to change the special "backslash" character to "slash" one. I was thinking re.sub substitutes all occurences but whatever I've tested so far, it fails (same result using replace()): what I'm missing?
leading to:
Paul
Typically in a Windows path, I want to change the special "backslash" character to "slash" one. I was thinking re.sub substitutes all occurences but whatever I've tested so far, it fails (same result using replace()): what I'm missing?
Path = 'D:\My Directory1\bin' NewPath = re.sub(r'(\\)', '/', Path) print(f"New path = {NewPath}")(of course the number of "\" can change)
leading to:
Output:New path = D:/My Directoryin
ThanksPaul