Mick_C

n00b question again...

Discussion created by Mick_C on May 1, 2011
Latest reply on May 1, 2011 by JScheirer-esristaff
Hi,

This concept seems really simple so I feel like a epic noob asking... sorry in advance.

I'm trying to add a text string to the string in another field like this:
string1 = '"First part of text"'
string2 = "arcpy.GetParameterAsText(0)"
string3 = '%s_%s' % (string1, string2)
arcpy.CalculateField_management(myfc,"TEXTFIELD", string3,"PYTHON")


I've tried several different ways of adding the fields together including:
string3 = string1 + string2 #does not work
string3 = string1 & string2 #does not work
string1 += "arcpy.GetParameterAsText(0)" #does not work
# putting the strings into fields:
string3 = '%s_%s' % (!STRING1!, !STRING2!) 


so I'm obviously stuffing up some basic syntax. I simply need to populate a field with some fixed text followed by a string that was entered as a parameter.

Thanks!
-Mick

Outcomes