taylor65

Using wildcards with Cursors

Discussion created by taylor65 on Jul 25, 2011
Latest reply on Jul 26, 2011 by taylor65
Can anyone help me place a wildcard where I have an asterisk for '*a' and '*b'? I know this code isn't right, almost got it though.

import arcpy

PATCH_MASTER = "C:\\PATCHES\\PATCH_MASTER.shp"

rows = arcpy.UpdateCursor(PATCH_MASTER)

for row in rows:
    if row.PATCH_CODE == '*a' or row.PATCH_CODE == '*b':
        if row.FID_PATCH_ <= 8:
            row.PATCH_CODE = date_code + "00" + str(row.FID_PATCH_ + 1)
            rows.updateRow(row)
        elif row.FID_PATCH_ <= 98 and row.FID_PATCH_ >= 8:
            row.PATCH_CODE = date_code + "0" + str(row.FID_PATCH_ + 1)
            rows.updateRow(row)
        else:
            row.PATCH_CODE = date_code + str(row.FID_PATCH_ + 1)
            rows.updateRow(row)

del row
del rows


Thanks!

Outcomes