I tend to use only forward slashes for paths (\'/\') and python is happy with it also on windows. In the description of os.path.join it says that is the correct way if you w
EDIT based on comment: path = os.path.normpath(path)
My previous answer lacks the capability of handling escape characters and thus should not be used:
Second, glue them back together using the correct symbol.
import os
path = 'c:\www\app\my/folder/file.php'
# split the path to parts by either slash symbol:
path = re.compile(r"[\/]").split(path)
# join the path using the correct slash symbol:
path = os.path.join(*path)