# -*- coding: utf-8 -*-
import arcpy
#path = raw_input('Input the path: ')
path = r"D:\henu\year"
arcpy.env.workspace = path
def listFeature():
featureList = []
years = range(1980,2009)
for year in years:
wildcard = '%s'%(str(year))
features = arcpy.ListFeatureClasses('*%s*'%wildcard)
for feature in features:
featureList.append(feature)
print '-'*50
return featureList
def clipFeature(featureList):
for in_feature in featureList:
clip_feature = r"D:\henu\province\zhongyuan.shp"
out_name = '%s_clip.shp'%in_feature[-8:-4]
out_feature = r"D:\henu\clip\%s"%out_name
arcpy.analysis.Clip(in_feature,clip_feature,out_feature)
print out_name
def main():
featureList = listFeature()
clipFeature(featureList)
if __name__ == "__main__":
main()
这个代码是用多个矢量裁剪,修改一个可以满足你的要求。