替换字符串
!autocad_so! .split("(".decode("UTF-8"))[0]
自定义标注
def FindLabel ( [autocad_so], [Shape_Area], [principal] ):
return str([autocad_so]) +"号\n".decode("utf-8") + [principal]+"\n"+str(round(float([Shape_Area])*15,2))+"亩".decode("utf-8")
字段计算
import re
def getclass(ne):
if re.search(";",ne):
return ne.split(";")[1]
else:
return ne
字符串第三位是数字则返回前三位,否则返回前两位
import re
def get(name):
if re.match("[0-9]",name[2]):
return name[0:3]
else:
return name[0:2]