论坛元老
- 威望
- 5054
- 贡献
- 5072
- 热心值
- 0
- 金币
- 294
- 注册时间
- 2020-3-17
|
# -*- coding: UTF-8 -*-
import arcpy.da # 导入arcpy.da站点包
import sys
import os
reload(sys)
sys.setdefaultencoding('utf-8')
arcpy.env.workspace = r"‪F:\学习实验" # 设置工作空间
# 普通遍历
# 条件遍历
with arcpy.da.SearchCursor("SHANDONG.shp", ("PAC", "Name"), '"PAC" > 370000.0 AND "PAC" < 380000.0') as cursor: # 使用with语句创建游标
for row in sorted(cursor): # 循环遍历SearchCursor中的行(sorted()排序)
print("编码: " + str(row[0]) + " | 名称:" + row[1]) |
|