ArcPy属性查询

 https://blog.csdn.net/u010608964/article/details/90607353

https://desktop.arcgis.com/zh-cn/arcmap/latest/analyze/arcpy-mapping/datadrivenpages-class.htm

对Table的查询:

获取Table地址:C:UsersAdministratorDownloadsjiangyin-统一属性2jiangyin-2020-12-10.gdb雨水_

游标Cursor:

https://blog.csdn.net/haichao062/article/details/8109427

https://www.cnblogs.com/hwd9654/p/5682217.html

>>> with arcpy.da.SearchCursor("雨水_",["管段编码","上游井编号"]) as cursor:
...     for row in cursor:
...         if(row[0].find("Y0000726-Y0000728")!= -1):
...             print(row[0])
...             
Y0000726-Y0000728
>>> 

问题代码:

def Cal(value):
  if(value is null):
    with arcpy.da.SearchCursor("污水$",["管段编码","管材"]) as cursor:
      for row in cursor:
        if(row[0].find(value)!= -1):
          return row[1]
  else if(value is not null):
    return value
  else:
    return 0

空字符串:https://blog.csdn.net/Elephantpretty/article/details/110529584   https://www.cnblogs.com/clarenceyang/p/9681653.html

正确:

def Cal(value):
  if(value==None):
    with arcpy.da.SearchCursor("雨水$",["管段编码","上游井编号"]) as cursor:
      for row in cursor:
        if(row[0].find(value)!= -1):
          return row[1]
  else:
    return value
原文地址:https://www.cnblogs.com/2008nmj/p/13859449.html