I would like to find a Python script that will access an attribute table within a shapefile and either update or replace records inside a field column. More specifically, I would like to use the replace expression to convert a table record like "123-456-789" to "123456789". I have many records to process and would like the best approach to do this task using Python.
|
What you need is an UpdateCursor.
Your code would look something like the following:
If you don't have ArcPy, you can use dbfpy to directly access and edit the attributes in the shape file's dbf file. The syntax is rather simple:
Good luck! |
||||
|
|
|
You may also use Field Calculator with Python expression |
|||||||
|
|
Alternatively and very straight forward you could also open the dbase table (dbf) coming with your shape in excel or libreoffice calc. They should be full editable and therefore you can simply remove all dashes in multiple columns. |
|||
|
|

