import os import arcpy as ap lines = ap.GetParameterAsText(0).split(";") claims = ap.GetParameterAsText(1).replace("'","") claims = claims.split(";") for line in lines: for claim in claims: output = os.path.join(ap.GetParameterAsText(2),line + "_" + claim.split("\\")[1]) ap.Intersect_analysis([line, claim],output,"","","LINE")
Nice to see this is still irritating people literally 10 years later.
I just encountered this same problem in my tool. Having a space in the string makes the param wrap with quotes. Putting a single quote (') in the string makes the param wrap with double quotes ("). It'll escape the quotes if you put both styles in.
"P20\'30\"" <-- supposed to be P20'30"
I have been a programmer since before using ArcGIS, and this behavior of the multivalue parameter is stupid.
Anyway, using strip() is safer than replace(), since you might have quotes in the middle of your parameter choices. replace() will eliminate them all, while strip() will remove characters from both ends of the string until it encounters a character that isn't in the string passed to strip().