path backslash escaping trouble

placid Bulkan at gmail.com
Tue Jul 10 03:40:04 CEST 2007


Hi All,

I have these files; which are Merge Request (ClearCase) files that are
created by a Perl CGI script (being re-written in Python, as the HTML/
JavaScript have been mixed with Perl, maintainability is zero)

MergeType::::codefromlabel::::
BLname::::BUILDMODS::::
OldLname::::::::
BaseVersion::::6.9.1.24A::::
RequiredRelease::::6.10.1.3::::
Description::::::::
FixRelation::::::::
Dependencies::::::::
LpAffected::::No::::
CodeReview::::FirstName LastName::::
Testing::::Compile/Build;Designer;Smoketests;::::
OtherTesting::::::::
Vobs::::ipsupport;::::
Elements::::\ipsupport\ipbuild\Wizard\build.pl@@\main\buildmods\3::::

i read this whole file into a string so i can search for the value of
Elements which is
\ipsupport\ipbuild\Wizard\build.pl@@\main\buildmods\3

but this path is escaped
\\ipsupport\\ipbuild\\Wizard\\build.pl@@\\main\\buildmods\\3

so when i try to escape a string containing that same path using any
of the os.path escaping methods doesnt
result in the correct escaped path. It either appends "C:\\" in front
of the string with all the backslashes escaped
or it converts the three(3) at then end to "x03" and a match doesnt
occur!

My question is, is there a function in Python that only escapes
backslashes?

Cheers




More information about the Python-list mailing list