我最终需要显示我的列表中文件以 .shp 结尾的所有项目。所以我需要能够分别索引每个列表项。有什么建议么?
这是我到目前为止所拥有的:
folderPath = r'K:\geog 173\LabData'
import os
import arcpy
arcpy.env.workspace = (folderPath)
arcpy.env.overwriteOutput = True
fileList = os.listdir(folderPath)
print fileList
"""Section 2: Identify and Print the number
and names of all shapefiles in the file list:"""
numberShp = 0
shpList= list()
for fileName in fileList:
print fileName
fileType = fileName[-4:]
print fileType
if fileType == '.shp':
numberShp +=1
shpList.append(fileName)
print shpList
print numberShp