I wanted to convert simply from '/' to '' in the python code. I have one shared folder 'test_folder' from windows PC (IP: 192.168.1.1). I had used os, pathlib and ntpath libraries. But, all gave result with double ''. I just wanted path to be converted to windows-like path with single ''. Below solution using re module solved the problem.
import re
unix_path = '//192.168.1.1/test_folder/'
win_path = re.sub(r'/', r'\\', unix_path)
print(win_path)
This may not be the exact solution. But, it can solve the problem.
I wanted to convert simply from '/' to '' in the python code. I have one shared folder 'test_folder' from windows PC (IP: 192.168.1.1). I had used os, pathlib and ntpath libraries. But, all gave result with double ''. I just wanted path to be converted to windows-like path with single ''. Below solution using re module solved the problem.
import re
unix_path = '//192.168.1.1/test_folder/'
win_path = re.sub(r'/', r'\\', unix_path)
print(win_path)