On Sun, Jul 31, 2011 at 08:59, Sergey <ser...@mighty.co.za> wrote: > Gotcha! > http://pymon.googlecode.com/svn/tags/pymon-0.2/Internet/rsync.py > 231-239 strings > > ## code ## > > def convertPath(path): > # Convert windows, mac path to unix version. > separator = os.path.normpath("/") > if separator != "/": > path = re.sub(re.escape(separator), "/", path) > > # Help file, folder pattern to express that it should match the all > file or > folder name. > path = "/" + path > return path > > ## code ##
Nice! I went with import os.path import re def convertPath(path): separator = os.path.normpath("/") if separator != "/": path = re.sub(re.escape(separator), "/", path) return path path=r'C:\Users\Dick\Desktop\Documents\Notes\College Notes.rtf' print(convertPath(path)) """ Output C:/Users/Dick/Desktop/Documents/Notes/College Notes.rtf """ Dick _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor