Select to view content in your preferred language

How to read Multivalues from parameter into string Using Python

1014
2
08-05-2011 11:25 AM
MikeMacRae
Frequent Contributor
I have set up a parameter with date type as "Date". I have also set the parameter to include multivalues so the user can enter various dates into a multivalue list. I want to pass the values into a list of strings or a table or something so that I can iterate through each one and read.

Basically, I have this:

import arcpy

Date1 = arcpy.GetParameterAsText(0)

arcpy.AddMessage(Date1)


When I add some dates to the value list, the AddMessage returns this:

08-26-2009;08-27-2009;08-29-2009

I want to split the values from the semicolons and store them so that I can use the values to enter into a text string later on in my script.

Thanks,
Mike

Thanks,
Mike
Tags (2)
0 Kudos
2 Replies
JasonScheirer
Esri Alum
Dates = arcpy.GetParameterAsText(0).split(";")
0 Kudos
MikeMacRae
Frequent Contributor
Jason, again you've offered a good solution.

Thanks,
Mike
0 Kudos