ejones78

passing multivalues into python using arcpy.Get ParameterAsText

Discussion created by ejones78 on Dec 8, 2011
Latest reply on Dec 8, 2011 by ejones78
Howdy All~

I've found a couple ESRI examples where they show how you can pass multivalues into a script (arcpy.GetParameterAsText(0)) and then use .split(";") to split the value list. When I try it python doesn't split on the ";" it splits every single character in the list. I've tried changing split characters and get the exact same result. Below is a sample of my test script where I have input 2 files, it prints out the list showing both files separated by a ";" and then prints each split out value:

InASCIIList = arcpy.GetParameterAsText(0)
arcpy.AddMessage ("InASCIIList is " + InASCIIList)
InASCII = InASCIIList.split(";")
for InASCII in InASCIIList:
      arcpy.AddMessage ("InASCII is " + InASCII)


and here's what prints out:
Executing: listtest D:\TEST\script\testasc\month11_7450p.asc;D:\TEST\script\testasc\month10_7450p.asc D:\TEST\script\OutputFolder
Start Time: Fri Dec 09 10:51:15 2011
Running script listtest...
InASCIIList is D:\TEST\script\testasc\month11_7450p.asc;D:\TEST\script\testasc\month10_7450p.asc
InASCII is D
InASCII is :
InASCII is \
InASCII is T
InASCII is E
InASCII is S
InASCII is T
InASCII is \
InASCII is s
InASCII is c
InASCII is r
InASCII is i
InASCII is p
InASCII is t
InASCII is \
InASCII is t
InASCII is e
InASCII is s
InASCII is t
InASCII is a
InASCII is s
InASCII is c
InASCII is \
InASCII is m
InASCII is o
InASCII is n
InASCII is t
InASCII is h
InASCII is 1
InASCII is 1
InASCII is _
InASCII is 7
InASCII is 4
InASCII is 5
InASCII is 0
InASCII is p
InASCII is .
InASCII is a
InASCII is s
InASCII is c
InASCII is ;
InASCII is D
InASCII is :
InASCII is \
InASCII is T
InASCII is E
InASCII is S
InASCII is T
InASCII is \
InASCII is s
InASCII is c
InASCII is r
InASCII is i
InASCII is p
InASCII is t
InASCII is \
InASCII is t
InASCII is e
InASCII is s
InASCII is t
InASCII is a
InASCII is s
InASCII is c
InASCII is \
InASCII is m
InASCII is o
InASCII is n
InASCII is t
InASCII is h
InASCII is 1
InASCII is 0
InASCII is _
InASCII is 7
InASCII is 4
InASCII is 5
InASCII is 0
InASCII is p
InASCII is .
InASCII is a
InASCII is s
InASCII is c
Completed script listtest...
Succeeded at Fri Dec 09 10:51:15 2011 (Elapsed Time: 0.00 seconds)


Any help or input would be greatly appreciated!

Outcomes