Take the 2-minute tour ×  I need to do something in regex but
I'm really not good at it, long time didn't do that .   I need
to change it to   Please trying to do it by using regular
expression in Python.  share|improve this question Why do you
need to change this? Python can do just fine with / as a path
separator. –  JoshD Oct 22 '10 at 3:34 add comment  5 Answers
I'm entirely in favor of helping user483144 distinguish
"solution" from "regular expression", as the previous two
answerers have already done. It occurs to me, moreover, that
os.path.normpath() http://docs.python.org/library/os.path.html
might be what he's really after.  share|improve this answer add
comment  why do you think you every solution to your problem
needs regular expression??  >>> s="/a/c/a.doc" >>>
'\\'.join(s.split("/"))  By the way, if you are going to change
path separators, you may just as well use os.path.join   mypath
= os.path.join("C:\\","dir","dir1")  Python will choose the
correct slash for you. Also, check out os.sep if you