for category in categories:
folder = os.path.join(directory, category)
print(folder)
The output is:
C:\Users\Sibarani\OneDrive\Desktop\Data/cats
C:\Users\Sibarani\OneDrive\Desktop\Data/dogs
expected result is
C:\Users\Sibarani\OneDrive\Desktop\Data\cats
C:\Users\Sibarani\OneDrive\Desktop\Data\dogs
>Solution :
Although it is normally better to use forward slashes exclusively, this can be easily accomplished with string.replace().
e.g.
for category in categories:
folder = os.path.join(directory, category).replace("/", "\\")
print(folder)