首页 > 编程 > Python > 正文

Python/ArcPy遍历指定目录中的MDB文件方法

2020-02-15 23:24:18
字体:
来源:转载
供稿:网友

如下所示:

#遍历指定目录中的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/ArcPy遍历指定目录中的MDB文件方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林站长站。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表