Posted in Python onOctober 27, 2018
如下所示:
#遍历指定目录中的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.mdb C:\Users\lenovo\Desktop\modified\74754025.mdb\BOUAN C:\Users\lenovo\Desktop\modified\74754025.mdb\BOULK C:\Users\lenovo\Desktop\modified\74754025.mdb\BOUNT C:\Users\lenovo\Desktop\modified\74754025.mdb\BOUPT C:\Users\lenovo\Desktop\modified\74754025.mdb\CTRLK C:\Users\lenovo\Desktop\modified\74754025.mdb\CTRPT C:\Users\lenovo\Desktop\modified\74754025.mdb\HYDAN C:\Users\lenovo\Desktop\modified\74754025.mdb\HYDLK
以上这篇Python/ArcPy遍历指定目录中的MDB文件方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。
Python/ArcPy遍历指定目录中的MDB文件方法
- Author -
suixhcud声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@