I am trying to convert the window path in Pathlib to string.
However, I can't convert the \\ to \
The code I ran
fileDir = pathlib.Path(self.CURRENTDATAPATH)
fileExt = r"*.xlsx"
for item in list(pathlib.Path(fileDir).glob(fileExt)):
self.XLSXLIST.append( str(item).replace( '\\\\', "\\") )
Got the result:
['D:\\data\\test.xlsx']
I would like to get this result
['D:\data\test.xlsx']