Python/ArcPy遍历指定目录中的MDB文件方法
时间:2022-02-08 17:48 作者:admin
如下所示:
#遍历指定目录中的MDB文件,构造FeatureClass名>>> target_folder = 'D:\T20161202'... file_names=('BOUAN','BOULK','BOUNT','BOUPT','CTRLK','CTRPT','HYDAN','HYDLK','HYDNT','HYDPT','PIPAN','PIPLK','PIPNT','PIPPT','RESAN','RESLK','RESNT','RESPT','ROAAN','ROALK','ROANT','ROAPT','TERAN','TERLK','TERNT','TERPT','VEGAN','VEGLK','VEGNT','VEGPT')... source_folder = 'C:\Users\lenovo\Desktop\modified'... for x in os.listdir(source_folder):... file_path = source_folder+'\\'+x... if os.path.isfile(file_path):... print file_path... mdb_paths= os.path.split(file_path)... mdb_names = mdb_paths[1].split('.')... if mdb_names[-1]=='mdb':... for file_name in file_names:... feature_class = os.path.join( file_path,file_name)... print feature_class... C:\Users\lenovo\Desktop\modified\74754025.mdbC:\Users\lenovo\Desktop\modified\74754025.mdb\BOUANC:\Users\lenovo\Desktop\modified\74754025.mdb\BOULKC:\Users\lenovo\Desktop\modified\74754025.mdb\BOUNTC:\Users\lenovo\Desktop\modified\74754025.mdb\BOUPTC:\Users\lenovo\Desktop\modified\74754025.mdb\CTRLKC:\Users\lenovo\Desktop\modified\74754025.mdb\CTRPTC:\Users\lenovo\Desktop\modified\74754025.mdb\HYDANC:\Users\lenovo\Desktop\modified\74754025.mdb\HYDLK
以上这篇python/' target='_blank'>python/ArcPy遍历指定目录中的MDB文件方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
(责任编辑:admin)