Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to simply add a string in front of a group of numbers from another field in a new field. The filed I'm using update cursor in is GIS_ID_PAM and I'm trying to bring over numbers from a column called PointID. My intent is to get "PAM - " in front of the numbers from the PointID column. Here's what I have that isn't working.

        urows = arcpy.UpdateCursor(fc)
        for urow in urows:
            urow.DateImport = str(timestr)
            urow.GIS_ID_PAM = "PAM - " + [PointID]
share|improve this question
Is GIS_ID_PAM of field type Text or something else? – Martin Mar 13 '14 at 14:43
If you are using ArcMap >= 10.1, you should investigate the data access module. Much better cursor support. – Paul Mar 13 '14 at 22:15
up vote 10 down vote accepted

If PointID is one of the fields of fc, you can either use

urow.GIS_ID_PAM = "PAM - " + str(urow.PointID)


urow.setValue("GIS_ID_PAM", "PAM - " + str(urow.getValue("PointID"))

str() is not necessary if your PointID field is already of type "text".

EDIT : example with .format() (based on Paul's comment)

urow.setValue("GIS_ID_PAM", "PAM - {0!s}".format(urow.getValue("PointID"))
share|improve this answer
Instead of using string concatenation, you might want to use .format(). It has built in string casting for variables and can be a lot simpler when concatenating strings and variables. – Paul Mar 13 '14 at 22:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.