Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

add row and input value under "CXXXX"

$
0
0
System ArcGIS 9.3
python 2.6

Hello

I am trying to add a row to about 100 point shapefiles in a folder.
When adding a row, I also want to key in a string S under the field "CXXXX."
Different shapefiles have different CXXXX fields, such as C0001, C0089, and C0100.
The field is string, starting with C and followed by four digits.

The python code is almost ready, except the part of "CXXXX."
Please kindly help and thank you.

Code:

# Create the insert cursor and a new empty row
        rowsNew = gp.InsertCursor("lyr")
        rowNew = rowsNew.newRow()

        # Populate attributes of new row
        rowNew.setValue("C****", "S")

        # Insert the new row into the shapefile
        rowsNew.insertRow(rowNew)

        # Clean up the cursor
        del rowsNew


Viewing all articles
Browse latest Browse all 2485

Trending Articles