Arcpy基础入门-6、遍历

1、列出所有的要素类

import arcpy

arcpy.env.workspace = "D:\用户目录\Documents\ArcGIS\可达性分析成果.gdb"

# Use Python's built-in function len to reveal the number of feature classes
#   in the workspace
fcs = arcpy.ListFeatureClasses()

fcCount = len(fcs)
for fc in fcs: 
    # Copy the features from the workspace to a folder
    #
    print fc
    

print fcCount

2、列出所有的数据集

import arcpy
arcpy.env.workspace = "D:\数据备份.gdb"

ds = arcpy.ListDatasets()

dsCount = len(ds)
for dataset in ds:
   print dataset
print dsCount

3、列出文件下所有的文件

import arcpy

arcpy.env.workspace = "E:\KuGou"

# Use Python's built-in function len to reveal the number of feature classes
#   in the workspace
files = arcpy.ListFiles()

fcCount = len(files)
for fc in files: 
    # Copy the features from the workspace to a folder
    #
    print fc
    

print fcCount

4、列出所有的栅格文件

import arcpy
import arcpy.sa

arcpy.env.workspace = "E:\LE71230392003097EDC00"

# Use Python's built-in function len to reveal the number of feature classes
#   in the workspace
rasterlist = arcpy.ListRasters()

fcCount = len(rasterlist)
for fc in rasterlist: 
    # Copy the features from the workspace to a folder
    #
    print fc
    

print fcCount



  • 5
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值