I have written a code in python which uses / to make a particular file in a folder, if I want to use the code in windows it will not work, is there a way by which I can use
You can use os.sep:
>>> import os
>>> os.sep
'/'
os.path.normpath(pathname) should also be mentioned as it converts /
path separators into \
separators on Windows. It also collapses redundant uplevel references... i.e., A/B
and A/foo/../B
and A/./B
all become A/B
. And if you are Windows, these all become A\B
.
Some useful links that will help you: